-
Notifications
You must be signed in to change notification settings - Fork 12k
Corrupted image when using css-loader+file-loader+AngularCompilerPlugin #8891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That starter doesn't appear to be using the AngularCompilerPlugin but rather a different plugin combined with the |
I'm using AngularCompilerPlugin in my project though. I will continue to investigate this today. Will try to find out where in the process this extra corrupt image is created and by what loader. But as you say, It might definitely be a configuration issue. There's so much angular specific stuff going on I don't really know whats doing what. I can upload our configs when I'm back at work. |
It doesn't seem like this is connected to this plugin in particular. It's reproducible with AnuglarCompilerPlugin. |
@JonWallsten did you find a solution to this problem yet? I'm having the same behaviour and can't figure out the problem too, since it worked with Angular 4 and the AotPlugin from |
@michaelfaisst Sorry, I was digging the entire weekend, but my knowledge of Webpack, and Angular for that matter, is to thin. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Repro steps
These steps are borrowed from here since share the same problem and my project is to complex to just do a plunker from: PatrickJS/PatrickJS-starter#1939
Add declaration in the styles.scss:
Observed behavior
In the dist folder there will be two generated png files instead of one. One file is slightly larger then the original file. It's also corrupted and can't be viewed (not even in PS). They have different hashes in the generated name, which I guess makes sense since it's the MD5 hash of the file if I'm not mistaken.
When looking in are main.js file I can see that the images references in the background: url() is the corrupt image. This was not happening when running Angular 4 and JIT.
Desired behavior
Only one image should be created and it should not be corrupt.
Mention any other details that might be useful (optional)
I've read through tons of tickets, documentation and tried more combinations in my Webpack config than I can count. The reason I'm writing this ticker here is because of the following quote in the issue tracker.
url()'s in component stylesheets are now processed. This allows the CLI to hash the assets and supports long-term caching. However, the URL now needs to be build-time discoverable and the path must be relative to the component stylesheet for this to work. This also has the advantage that component based assets can be encapsulated within the component source location, if desired.
Forgive me if this is not an Angular CLI issue. But I can't find any related issue with css-loader and file-loader alone. And since the first image is generated fine I suspect something is happening after they are done. Unfortunately there's so much stuff happening behind the curtain, I don't even know who creates the second file.
This is a log from my own project, not the sample one.
You can clearly see the correct image 'bf8...' being generated.
But there is no references in the log to the corrupt file besides in the list of generated files.
It just magically appear in the list of resources. And as mentioned earlier it also ends up in the generated CSS instead of 'bf801dc8612d99ff6adbe37a8dca7877.jpg'.
The text was updated successfully, but these errors were encountered: