Skip to content
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

1.3.0 broke usage with external-svg-sprite-plugin #653

Closed
mihkeleidast opened this issue Nov 6, 2020 · 6 comments
Closed

1.3.0 broke usage with external-svg-sprite-plugin #653

mihkeleidast opened this issue Nov 6, 2020 · 6 comments

Comments

@mihkeleidast
Copy link

  • Operating System: Windows
  • Node Version: 12.18.2
  • NPM Version: 6.14.8
  • webpack Version: 4.44.2
  • mini-css-extract-plugin Version: 1.3.0

Expected Behavior

Webpack build succeeds when using both mini-css-extract-plugin and external-svg-sprite-loader.

Actual Behavior

Webpack build fails.

Code

repo: https://github.com/mihkeleidast/webpack-css-svg-issue

How Do We Reproduce?

See repo with repro.

I think #647 broke this.

@alexander-akait
Copy link
Member

Open an issue in external-svg-sprite-loader

@alexander-akait
Copy link
Member

Sorry, we can't do something on our side

@mihkeleidast
Copy link
Author

Can you explain? Is the module.content external-svg-sprite-loader is trying to replace as string not guaranteed to be a string anymore? What is the expected type of module.content?

@alexander-akait
Copy link
Member

Buffer, I recommend do not rely on this, it is internal, but I think it will be buffer always and will not changed anymore

@bensampaio
Copy link

@evilebottnawi was this change introduced on 1.3.0? Do you have any suggestions on how to go around this issue?

The external-svg-sprite-loader relies on the module.content property because at the time the loader generates its output the SVG Sprite URL is not yet known. It is only possible to know the final URL after all SVG's were processed because the URL might include a [contenthash]. Therefore, during the optimize modules phase the plugin needs to replace the URL with [contenthash] to the actual URL with the generated hash. Do you see any other way around this issue?

@alexander-akait
Copy link
Member

@bensampaio Just content.toString()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants