Replies: 1 comment
-
|
cc @ahabhgk |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently there is always a corresponding js module in the output, even the css module exports nothing.
The root cause of that is, the dependency point to the css module is HarmonySideEffectsDependency, it has 2 effects:
__webpack_require__)For css module whose and exports type is object (not stylesheet or string), we use SideEffectDependency just want to connect it. We can use replace it as a special ImportCSSdependency.
The dependency doesn't render, so there is no
__webpack_require__('src/index.css')in the output. And when CSS module generates, it will look for all incoming connections to know what sourceType it should generate to. Connection with ImportCSSdependency can be skipped, so it won't generate unnecessary js code in the output.For those who use exports from the css module, eg.
It has importSpecifierDependency, so the referenced css still need to generate js output just like now, we just change the HarmonySideEffectsDependency
There is also a plan B
We just do something in
HarmonySideEffectsDependency.TemplateinCssModulesPlugin, make it renders nothing, and inCssGenerator.getTypeswe skip checkingSideEffectDependencyincoming. This is easier to implementBeta Was this translation helpful? Give feedback.
All reactions