-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
0.15.0+ makes Webpack load slowly #124
Comments
Here's the webpack update output using css-loader 0.16.0 (same happens with 0.15.0+):
Here's the output with css-loader 0.14.5:
|
Same here, but I have more then 40 css (sass) modules, that take about 15 seconds with the old version and around 4 Minutes with the latest. |
still exists in 0.18, but its faster then the 0.16 build: 0.18.0:
0.14.5
|
Probably PostCSS, since that's the first thing that changed after 0.14.5, and that thing does a lot. IMO at this point CSS loader does too much. There's no real alternatives if you want url/import mapping and sourcemaps (raw-loader won't help with those), but to get those you have to pay the cost of all the bells and whistles. Is it time for a minimal css-loader that does just enough to pass stuff from the post-processors (like less-loader, sass-loader, etc) to style-loader as quickly as possible, with optional import/url support? |
I agree @Phoenixmatrix. There are still a lot of people who only want imports and urls to be resolved which doesn't even require an actual parser imho. What do you think @sokra? Is it time to separate the css-loader from css-modules? Did I miss something? |
css-loader gets slow after that. Related: * webpack-contrib/css-loader#124
same problem... |
Same problem here. With |
poke @ai |
New PostCSS is not slow then previous. But when you use depreacted PostCSS API it is of course slower, because it should print warning and call extra code. So, you should update webpack custom plugins for PostCSS 5.0 API (it is very simple) to remove all warnings. It will give a good speed boost. |
Here is benchmarks: PostCSS 4.x vs. 5.0. |
I'm having these issues too. |
@ai do you know which calls in https://github.com/webpack/css-loader/blob/master/lib/processCss.js are deprecated? I would take a stab at it, but am having trouble finding any information on deprecated methods from 4.0 |
I am not seeing anything in the source code that is deprecated based on this change log on deprecation |
@goldensunliu here is 5.0 changes post https://github.com/postcss/postcss/releases/tag/5.0.0 Maybe CSS Modules uses 4.0 API? |
@ai |
I still feel there's more to it than just "css-loader is using PostCSS so now its slow" PostCSS is reasonably fast. Using a couple of postcss things with raw loader is significantly faster than using css-loader stand alone. so I don't think it's just PostCSS usage. |
We have a postcss-devtools to find slowest plugin in PostCSS pipeline https://github.com/postcss/postcss-devtools I think it is a ideal case for it. |
@ai I tried adding
Any ideas? |
@billyjanitsch we need a full stacktrace to fix this issue |
@ai I figured out that it's because Is this valid (i.e. a bug in |
It is bad thing for public plugins https://github.com/postcss/postcss/blob/master/docs/guidelines/plugin.md#14-create-plugin-by-postcssplugin But we should fix it in postcss-devtools, because some debug/custom plugins could be without name. |
Anyway, I was able to hackily fix this for the purpose of debugging If anyone has more time to work on this, looking for perf improvements there might be a good place to start. |
@billyjanitsch I am using css-loader@0.23.1 with css-modules, when I downgrading to 0.14.1, it save 5 Update: just set the query params from 'modules' to 'module', it works fine for me |
I did some profiling with the sass-loader: webpack-contrib/sass-loader#296 (comment) |
Is this issue fixed yet? |
Does this issue also affect webpack 2 or 3? |
Nope, afaik it's not fixed. It's not directly related to webpack itself, but the way how the css loader works. |
Feel free to PR, what speedup css loader |
If you don't need sourceMap and css module, you can try fast-css-loader, it use RegExp to parse |
@yibn2008 note, that regexp is not a safe way for CSS since CSS could contain a string (inlined SVG?) or comments with directives inside. But it is a good idea to improve css-loader. Maybe we could try to create a css-loader fork with PostCSS (it’s parser is very fast), but without all features. Maybe CSS Modules is used every time and slow down the process? |
@ai I have handled comments in css, but inline SVG haven't been tested. I'll try to use postcss alone later to see is the performance improved. |
@ai it is in our plans in future, if somebody started this i can help |
In next major release (will be release in next future):
Feel free to open issue if you have ideas how we can increase perf more |
@evilebottnawi will be any limitation for minimal required version of webpack for this new release of css-loader? |
@ZuBB |
hi @evilebottnawi! Sorry to persist but I see in "BREAKING CHANGES" section of v1.0.0 next statement
considering this do you think your statement on |
@ZuBB we avoid using old |
thanks for reply @evilebottnawi! I got your point |
Seems like a huge performance regression was introduced a long time ago with v0.15.0. webpack-contrib/css-loader#124 I just confirmed it. With the latest release of css-loader, a test file of mine took 30 seconds to compile. After I downgraded to 0.14.5, that time was reduce to 12 seconds.
Seems like a huge performance regression was introduced a long time ago with v0.15.0. webpack-contrib/css-loader#124 I just confirmed it. With the latest release of css-loader, a test file of mine took 30 seconds to compile. After I downgraded to 0.14.5, that time was reduce to 12 seconds.
Ever since the 0.15.0 update, I've had to revert back to 0.14.5, because Webpack loads very slowly (12 secs vs almost 60 secs). Is there a breaking change I should be aware of? Maybe something regarding PostCSS?
The text was updated successfully, but these errors were encountered: