developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8.03k stars 362 forks source link

Fix problem #960

Closed zyrong closed 2 years ago

zyrong commented 2 years ago

fix: css compilation problems when multiple entries

fix: Fix problems related to use rollup-plugin-terser

  1. The nameCache obtained in writebundle hook is not a reference to terseroptions
  2. JSON.stringify(nameCache) requires converting regex to a string first.
changeset-bot[bot] commented 2 years ago

🦋 Changeset detected

Latest commit: b0f22912ad4e6f215f272202f528311a38643be8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ----------- | ----- | | microbundle | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

rschristian commented 2 years ago

Would you mind splitting half of this out into another PR? Fixing two (seemingly) different issues in one PR makes it a bit hard to review and follow.

Edit: Also helps the history. With both fixes in one PR, it's a bit murky which bit of code fixes what issue. If there's ever problems, it helps if it's clear to what issue a line was altered/added.

For both, do you mind writing up issues showcasing the problems you're experiencing?

css compilation problems when multiple entries

This is a bit vague, for example. It's difficult to review the work because I don't know what issues you've run into or if your added test cases adequately check your fix.

Thanks

zyrong commented 2 years ago

Would you mind splitting half of this out into another PR? Fixing two (seemingly) different issues in one PR makes it a bit hard to review and follow.

Edit: Also helps the history. With both fixes in one PR, it's a bit murky which bit of code fixes what issue. If there's ever problems, it helps if it's clear to what issue a line was altered/added.

For both, do you mind writing up issues showcasing the problems you're experiencing?

css compilation problems when multiple entries

This is a bit vague, for example. It's difficult to review the work because I don't know what issues you've run into or if your added test cases adequately check your fix.

Thanks

What should I do to split into two pr

  1. This commit fixes that when different entries reference different CSS, only the related CSS of the first entry will be packaged. For specific changes, please see this commit. I also added the corresponding test case fix: css compilation problems when multiple entries

  2. This commit fixes the problems related to terser namecache. When terser compresses the code, the damaged variable names will be written to the namecache. Finally, the namecache will be written to the file system in this code, but after my test, it doesn't seem to work here fix: Fix problems related to use rollup-plugin-terser

rschristian commented 2 years ago

What should I do to split into two pr

CSS fixes in one, Terser thing in another. Specific commits get lost as PRs are squashed and merged.

zyrong commented 2 years ago

What should I do to split into two pr

CSS fixes in one, Terser thing in another. Specific commits get lost as PRs are squashed and merged.

I have split it into two independent PRs and modified them. Can you make some suggestions or reply to the changes

rschristian commented 2 years ago

Superseded by #961 & #966