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

Fix #88 Breaks with mini-css-extract-plugin@1.3.0 #89

Merged
merged 4 commits into from
Nov 10, 2020

Conversation

bensampaio
Copy link
Owner

  • Convert the CssModule content to string in order to be able to replace the Sprite URL.
  • Convert the CssModule content back to Buffer if it was a buffer before so that the plugin remains compatible with older versions of CssModule.
  • Change from [hash] to [contenthash] since this is now the recommended way of generating hashes and because this should also result in less filename changes.
  • Update the react example installation so that it uses hashes in order to no longer cache assets.

case 'CssModule': {
const content = sprite.replacePathsWithInterpolatedPaths(module.content.toString());

if (Buffer.isBuffer(module.content)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be an else if (typeof module.content === 'string') here? I'm guessing the update would break those using an older version of mini-css-extract-plugin? I don't use this SVG path in CSS myself but just noticed it...

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, thanks for checking! That was my intention and then I ended up doing it wrong 😅

Should be fixed now.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I released it as 7.1.0-beta.2. Can you let me know if this still works for you just as a sanity check?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it works in my repro repository.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll merge it and release it as 7.1.0 then :)

* Convert the `CssModule` content to string in order to be able to replace the Sprite URL.
* Convert the `CssModule` content back to `Buffer` if it was a buffer before so that the plugin remains compatible with older versions of `CssModule`.
* Change from `[hash]` to `[contenthash]` since this is now the recommended way of generating hashes and because this should also result in less filename changes.
* Update the `react` example installation so that it uses hashes in order to no longer cache assets.
* Convert the `CssModule` content back to the original format so that the plugin remains compatible all versions of `CssModule`.
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

Successfully merging this pull request may close these issues.

None yet

2 participants