grunt-bable's compile is terrible slowly
See original GitHub issuerecently, i have used grunt-beble to transform es6 to es5 in my project. it worked but i found that the compile time is so long.it took 6~7 seconds to compile one es6 file which only has one line code in it.
here’s my npms “devDependencies”: { “babel-preset-es2015”: “^6.1.4”, “grunt-babel”: “^6.0.0”, “time-grunt”: “^1.2.2” }
my gruntfile: grunt.initConfig({ pkg: grunt.file.readJSON(‘package.json’),
babel: {
test: {
options: {
presets: ['es2015'],
compact: false
},
files: [{
expand: true,
cwd: 'test',
src: ['*.es6'],
dest: 'dist',
ext: ".js"
}]
}
}
});
and the es6 file’s contents let a = 1; let b = 2;
the compile result: λ grunt Running “babel:test” (babel) task
Done, without errors.
Execution Time (2015-11-12 03:06:05 UTC) loading tasks 1s ██████████████████████████ 13% babel:test 7s ████████████████████████████████████████████████████████████ Total 8s
i have tried to find the reason in google,but no one mentioned this situation。 has anybody comes my question? much thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (2 by maintainers)
Top GitHub Comments
I found that I had to use “nospawn” on my watch task to ensure the same babel instance is reused and “grunt-newer” to ensure only the changed files are compiled. However grunt-mocha-test doesn’t like nospawn, so I ended up having to split my watch task in two and use grunt-concurrent to run both watches at the same time. Now I’m down from a 4.1 second delay after each compile to a 0.1 second delay.
You could use https://github.com/tschaub/grunt-newer for caching.
This is an issue with Babel itself, not this plugin specifically, so please continue this in https://phabricator.babeljs.io/