Skip to content

newer version makes webpack slowly #516

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

Closed
kimown opened this issue Apr 25, 2017 · 5 comments
Closed

newer version makes webpack slowly #516

kimown opened this issue Apr 25, 2017 · 5 comments

Comments

@kimown
Copy link

kimown commented Apr 25, 2017

Do you want to request a feature or report a bug?

bug
What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce.

the same issue #124, I make a simple test, I only change different version of css-loader in my project, here is the screenshot. It seems if I use a newer version of css-loader, the speed will be slower.

css-loader : 0.28.0 , average time is about 6s
image

css-loader : 0.23.1 , average time is about 3s

image

css-loader : 0.14.5, average time is about 2s
image

image

Please mention other relevant information such as your webpack version, Node.js version and Operating System.

webpack 2.2.1
node v7.6.0
osx 10.11.6

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Apr 25, 2017

Thx, we are aware of this already 😛 , css-loader v0.14.0+ added CSS Modules to the loader and that's why css-loaderis slower now (Parsing). This will be fixed in the next major release of css-loader where CSS Modules will be refactored out of the loader and need to be used as a opt-in (plugin) via postcss-loader, but it requires changes all over the place and is simply WIP atm

@dcworldwide
Copy link

This is so painful right now. I'm afraid to do any front end dev my productivity is way down. Really wish I could help..

@alexander-akait
Copy link
Member

@dcworldwide in enar future we release new version css-loader without postcss and css-modules (it be separate plugin for postcss-loader), also your can use cache-loader. Also your can provide webpack config and i will try to give advice, usually poor performance is associated with improper configuration

@dcworldwide
Copy link

dcworldwide commented May 14, 2017

@evilebottnawi That's really good news. I think a lot of people will benefit from that work.

Would be great to learn if there are things we can do to optimise build times in the interim.

My config is:

/**
 * @see https://webpack.js.org/loaders/css-loader/
 * @see https://github.com/webpack-contrib/sass-loader
 */
exports.setupCSS = function (paths) {
    return {
        module: {
            rules: [
                {
                    test: /\.css/,
                    use: [
                        'style-loader',
                        'css-loader'
                    ],
                    include: paths
                },
                {
                    test: /(\.scss|\.sass)$/,
                    use: ExtractTextPlugin.extract({
                        fallback: "style-loader",
                        use: [
                            {
                                loader: 'css-loader',
                                options: {
                                    sourceMap: true,
                                    importLoaders: 1,
                                    modules: true,
                                    // url: true,
                                    // import: true,
                                    // localIdentName: '[name]__[local]--[hash:base64:5]',
                                    hashPrefix: 'package-name' + Date.now(),
                                    localIdentName: '[path][name]__[local]--[hash:base64:5]',
                                    discardComments: {
                                        removeAll: true
                                    }
                                }
                            },
                            {
                                loader: "sass-loader",
                                options: {
                                    sourceMap: true
                                }
                            }
                        ]
                    })
                }
            ]
        }
    };
}

I'm going to try disabled source maps and comment striping.

@alexander-akait
Copy link
Member

@dcworldwide seems all right (yep, disabling source map speedup build), maybe your have some plugins, which spend a lot of time?

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

No branches or pull requests

4 participants