question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

grunt-bable's compile is terrible slowly

See original GitHub issue

recently, 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:closed
  • Created 8 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
insidewhycommented, Sep 14, 2016

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.

0reactions
sindresorhuscommented, Mar 10, 2016

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/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publish as modules (instead of compiling to cjs) · Issue #11701
Would like to be able to consume babel packages directly as modules (as they are written), instead of just cjs. (In my case,...
Read more >
Grunt so slow with watch multiple less tasks - Stack Overflow
I have a simple less files with very little contents but the compile time varies from 10 - 27s. Any ideas as to...
Read more >
[discussion] How did we go from Grunt to Gulp to Webpack?
So Gulp comes around. Says, do away with configuration, it's easier to just to code your build process, and you get far better...
Read more >
Esbuild – An extremely fast JavaScript bundler - Hacker News
I have two 50K+ LOC projects using esbuild, and I would use it even if it was slower than webpack/babel/tsc simply not to...
Read more >
Make UglifyJS way faster by using it sooner | by Adam Hooper
There are two problems. First, the minify step gets slower and slower when you add more code. Second, the minify results can't be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found