-
-
Notifications
You must be signed in to change notification settings - Fork 386
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
Feature: Disable Extracting Specified CSS Module from Chunks #432
base: master
Are you sure you want to change the base?
Feature: Disable Extracting Specified CSS Module from Chunks #432
Conversation
Well... the lint problems may be a bit difficult to be fixed... |
4d29761
to
f9d7df1
Compare
What is use case? Why you need disable async css?, also i think we should solve this in other case, provide developers function |
@evilebottnawi See this comment. I don't need to make extra an request to fetch the css file of its own async js chunk which it has been loaded. |
@lsycxyj please read my comment above, we can implement general solution instead only for one case |
@evilebottnawi For general solution, I think a "shouldBeExtracted" function for all modules would be much better. I can decide whether a css module depending on its information: whether it is an async module, content, file size, and more. |
@lsycxyj yes, feel free to update PR and implement this option 👍 |
@evilebottnawi I managed it. Now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here a lot of breaking changes, regressions and very bad code, idea is good, but implementation very bad
Look here https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/src/loader.js#L101, just skip module for keeping module in js |
@evilebottnawi Do you mean like my latest commit? (37ce619). I made less code difference. |
…into feature/disable_async_20190719
@evilebottnawi Friendly ping |
Hi, @evilebottnawi, Is there anything else need to be improved? I suppose there can't be less code changes to implement this feature. |
In todo, a lot of issues, you can use own branch if need this asap |
Merge from latest master, fix bug and reopen |
Known issue: some variables will become "void 0" in some modules after enabling disableExtract in complicated cases, and I don't have any good idea that I can rebuild the modules correctly. Could you do me a favor, please? @evilebottnawi |
…sync_20190719 # Conflicts: # README.md # azure-pipelines.yml # package-lock.json # package.json # src/index.js # src/loader.js # test/TestCases.test.js # test/helpers/getCompiler.js # test/helpers/index.js # test/manual/webpack.config.js
Codecov Report
@@ Coverage Diff @@
## master #432 +/- ##
==========================================
+ Coverage 88.55% 89.68% +1.13%
==========================================
Files 5 5
Lines 428 475 +47
Branches 96 104 +8
==========================================
+ Hits 379 426 +47
Misses 47 47
Partials 2 2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functionally seem to be based on rebuilding modules. That's really problematic as it leads to inconsistencies and performance problems. Rebuilding modules should be avoided.
There is already the option to apply mini-css only to some modules via the rule system. I don't think this PR is needed anymore when the isAsync
feature is removed.
|
||
```javascript | ||
const miniCssExtractPlugin = new MiniCssExtractPlugin({ | ||
disableExtract({ module, isAsync }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name it in positive way e.g. should extract
@sokra Thank you for your review. Actually, this feature is originally named "disableAsync". The main purpose of the feature is to find out async modules and disable the extraction programactically. Then, @evilebottnawi gave me advice that to do it with a function like I do understand it leads to some problems. However, I can't figure out any better way to implement the feature by now. I'm still looking for an alternative way. |
Why this is unacceptable? |
This PR contains a:
Motivation / Use-Case
You may disable extracting css modules programmatically by passing a function.
Breaking Changes
None
Additional Info
I found #348 doesn't work at all by now and it's not flexible enough, so I made another pull request based on recent master branch.