babel-loader 6 VERY slow in webpack

Created on 5 Nov 2015  路  4Comments  路  Source: babel/babel-loader

Windows 7, 64bit
Versions:
"babel": "^6.0.15",
"babel-core": "^6.0.20",
"babel-loader": "^6.0.1",
"babel-preset-es2015": "^6.0.15",
"babel-preset-react": "^6.0.15",
"babel-preset-stage-0": "^6.0.15",
"babel-preset-stage-1": "^6.0.15"

.babelrc
{
"presets": ["es2015", "stage-0", "react"]
}

Very simple build:

var path = require("path");
var webpack = require("webpack");

var webpackConfig = {
    cache: true,
    entry: {
        main: [
            './client/src/script1.js',
            './client/src/script2.js'
        ]
    },
    output: {
        path: path.join(__dirname, "client/public/"),
        filename: "app.js"
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
            }
        ]
    }
};
module.exports = webpackConfig;

Results:

Hash: cf6c2e62bc05bbcaeb94
Version: webpack 1.12.2
Time: 49403ms
 Asset     Size  Chunks             Chunk Names
app.js  1.75 kB       0  [emitted]  main
   [0] multi main 40 bytes {0} [built]
    + 2 hidden modules

When the babel-loader is commented out:

Version: webpack 1.12.2
Time: 204ms
 Asset     Size  Chunks             Chunk Names
app.js  1.72 kB       0  [emitted]  main
   [0] multi main 40 bytes {0} [built]
   [1] ./client/src/script1.js 48 bytes {0} [built]
   [2] ./client/src/script2.js 65 bytes {0} [built]

Please advise. Thank you.

Most helpful comment

If anyone's interested: I uninstalled all the babel 6 components, updated both node and npm to the newest versions and reinstalled the babel components. That fixed the performance problem.

All 4 comments

If anyone's interested: I uninstalled all the babel 6 components, updated both node and npm to the newest versions and reinstalled the babel components. That fixed the performance problem.

I'm on v6.6.0 and reinstall everything still takes like 5 secs to for babel to run through one js file with 1 line

Reinstalling everything fixed it for me.

@ghost Thanks a lot! Compilation time dropped from 6 seconds to 570 ms.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pingfengafei picture pingfengafei  路  3Comments

kohlmannj picture kohlmannj  路  6Comments

yuri-karadzhov picture yuri-karadzhov  路  3Comments

enjoylife picture enjoylife  路  3Comments

CellChen picture CellChen  路  3Comments