Add style index.js files to optionally consume the CSS via a js module import #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The webpack css-loader plugin does not deduplicate css that is imported via the css @import. Making the css available via a js module import lets webpack do deduplication at the module level in a way that respects the dependency ordering.
Adding these index.js files should not affect anything in Lumino itself, but just make it easier to consume the Lumino CSS and have deduplication.
This will help fix a problem in JupyterLab, for example, where the Lumino widget CSS will be duplicated on the page dozens of times because many modules require the CSS files directly (so css-loader is used). With this change, modules will be able to require the style/index.js module, so Webpack itself will deduplicate the imports, and the Lumino CSS will only be put on the page once.
The default-theme package needs a more complicated index.js since it uses @import in its index.css (in this case, css-loader would make a copy of the css).