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

allow to generate only exports for css in node #15200

Merged
merged 3 commits into from Jan 20, 2022
Merged

Conversation

sokra
Copy link
Member

@sokra sokra commented Jan 18, 2022

add more options to the DeterministicModuleIdsPlugin to allow to opt-in into a fixed mode

optimize module iterations for module id assignment

What kind of change does this PR introduce?
feature

Did you add tests for your changes?
yes

Does this PR introduce a breaking change?
no

What needs to be documented once your changes are merged?
nothing

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@sokra sokra force-pushed the feature/css-exports-in-node branch from b8e843c to 52e5257 Compare January 18, 2022 18:17
add more options to the DeterministicModuleIdsPlugin to allow to opt-in into a fixed mode

optimize module iterations for module id assignment
@sokra sokra force-pushed the feature/css-exports-in-node branch from 00934dd to 318f16e Compare January 19, 2022 14:17

const plugin = "SyncModuleIdsPlugin";

class SyncModuleIdsPlugin {
Copy link
Member

@vankop vankop Jan 20, 2022

Choose a reason for hiding this comment

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

So this should allowing to kind of map module name to id ? e.g.

{
    "C:\\Users\\a\\repo\\a.css|classname_aa": "1",
    "C:\\Users\\a\\repo\\b.css|classname_aa": "2",
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. Here you need to use it to sync the modules ids between Client and Server compiler so CSS Modules generate the same class names in both.

CSS Module class names are based on module ids in the new implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Example of the file:

{"./style.module.css":1876,"./style2.module.css":1054}

@sokra sokra force-pushed the feature/css-exports-in-node branch from 318f16e to 8828dfa Compare January 20, 2022 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants