-
Notifications
You must be signed in to change notification settings - Fork 271
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
Chunk for SVG sprite isn't properly created in extract mode #364
Comments
Hi, did you figure out this? |
I didn't in a proper way. I hope they will fix it until we go into production. You can comment out this line, which solved the problem for me. But I'm not sure what side effects it may cause. |
Ow, I did something similar adding this at line 168 I also do not know the side effects |
could someone fix this |
I create quick FIX plugin hope help you new class SVGSpriteExtractFixIdPlugin {
apply(compiler: Compiler) {
compiler.hooks.thisCompilation.tap(this.constructor.name, compilation => {
compilation.hooks
.optimizeChunkAssets
.tap(this.constructor.name, (chunks) => {
const svgChunk = chunks.find(chunk => !chunk.id && chunk.files.find(value => /\.svg$/.test(value)));
if (svgChunk) {
svgChunk.id = chunks.length;
svgChunk.ids.push(chunks.length);
}
return chunks;
});
});
}
} |
I've removed chunk creation. |
looks stable |
@kisenka |
@kisenka |
Do you want to request a feature, report a bug or ask a question?
report a bug
What is the current behavior?
When I integrate the svg-sprite-loader with the Angular CLI and build my app in production mode, following error is thrown:
Although the error is thrown in the package @angular-devkit/build-webpack the root cause lies in the plug-in of svg-sprite-loader. In the plug-in a new chunk for the SVG sprite is added to the webpack compilation without setting its
id
: https://github.com/kisenka/svg-sprite-loader/blob/85f07caed508403ab259b5b13eabc97704e0261b/lib/plugin.js#L165-L179What is the expected behavior?
The build in production mode with Angular CLI should work without throwing the error.
The best way is to create repo with minimal setup to demonstrate a problem (package.json, webpack config and your code).
Reproduction repo with instructions and a bit more background to the integration: https://github.com/TobiDimmel/angular-svg-sprite-issue
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
I wonder why the chunk is created and added in the first place. Wouldn't it be enough to only add the sprite to
compilation.assets
(how it's already done) and be done with it?A short test showed that commenting out the chunk adding solved the problem for my usecase.
The text was updated successfully, but these errors were encountered: