Skip to content

perf: use modules only if explicitly set #497

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

Conversation

alexander-akait
Copy link
Member

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?

Already have.

If relevant, did you update the README?

After accept.

Summary

Now css-loader it is not loader for css, many project don't use css-modules for their project, but seems (https://github.com/webpack-contrib/css-loader/blob/master/lib/processCss.js#L152) they are use always. We spend a lot of time on postcss-modules-*, even if I set modules: false. I think this is completely wrong and many issue about performance probably related to this. Right name for this loader is css-modules-loader.

postcss-loader in v2 (i hope we can release it faster) wants to abandon css-loader, allow use only postcss-loader handle css and etc stuff (url, imports and etc). In fact, this is the real css-loader, It is simple, does not contain any logic.

What we can do?

  1. Merge this PR before release css-loader (css-modules-loader) v1 and postcss-loader v2 (fix performance for project don't use css-modules).
  2. Move all logic not related to css-modules (urls, improts and etc stuff) to postcss-loader.
  3. Deprecated css-loader in favor css-modules-loader.
  4. ...
  5. PROFIT (better performance to project don't using css-modules, clear logic for postcss-loader and css-modules-loader, separation of issues - related to css-modules in css-modules-loader, related to css in postcss-loader)

Ref about postcss-loader v2: webpack-contrib/postcss-loader#177

Does this PR introduce a breaking change?

Should not.

Other information

Not required.

@codecov
Copy link

codecov bot commented Apr 17, 2017

Codecov Report

Merging #497 into master will decrease coverage by 0.23%.
The diff coverage is 97.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #497      +/-   ##
==========================================
- Coverage    98.3%   98.07%   -0.24%     
==========================================
  Files          10       10              
  Lines         354      363       +9     
  Branches       79       84       +5     
==========================================
+ Hits          348      356       +8     
- Misses          6        7       +1
Impacted Files Coverage Δ
lib/localsLoader.js 100% <ø> (ø) ⬆️
lib/loader.js 100% <ø> (ø) ⬆️
lib/processCss.js 97.45% <97.72%> (-0.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ee7552...88d95d0. Read the comment docs.

@michael-ciniawsky michael-ciniawsky self-assigned this Apr 17, 2017
@michael-ciniawsky michael-ciniawsky changed the title Fixed: improve performance without modules. perf: use modules only if explicitly set Apr 18, 2017
@michael-ciniawsky
Copy link
Member

@evilebottnawi I take a deeper look later, but this is also related to the removal of

:local .className local(.className) {...}

then, which is the main reason to always use CSS Modules atm, but it's a bad practice anyways 😛

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Apr 25, 2017

@evilebottnawi Agian this would be definitely a breaking change ? Should be because of :local(.className) {} not working anymore. In this case we need to close this PR and move on as discussed, since the next semver major of css-loader will definitely not contain CSS Modules anymore 😛

@alexander-akait
Copy link
Member Author

@michael-ciniawsky agree, let's close this and do all in steps 😄

@michael-ciniawsky michael-ciniawsky removed this from the 1.0.0 milestone Apr 25, 2017
@michael-ciniawsky michael-ciniawsky removed their assignment Apr 25, 2017
@alexander-akait alexander-akait deleted the improve-perf-without-modules branch April 25, 2017 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants