Webpack-encore: Possibility to disable babel loader

Created on 6 Sep 2017  路  9Comments  路  Source: symfony/webpack-encore

Hi,
Could you add possibility to disable babel loader.
For example, when using dev env it is not needed, and in this case rebuild is faster.

Most helpful comment

I found a solution by clear babel config presets :

.configureBabel(config => {
        config.presets = [];
})

All 9 comments

@wtorsi Is it a huge difference? We enable some babelrc caching... so I thought (but never really tested) that after the first build, future builds would not be too much slower (as much of the transformation would already be cached). I'm just trying to avoid adding options if possible, but I see your use-case :).

See this issue for improving the performance of source map generation.

Also, isn't Babel always needed whenever you add import statements to your code, considering no browser supports ES6 modules natively yet?

Edit: See @stof's reply below.

no, because webpack itself knows about import. Bundling modules is done by webpack, not by babel

@stof Thanks for the clarification, I forgot about this.

Hi,
I want to disable babel too, because im using TypeScript and don't need babel, currently babel edit my typescript outputs and change async/await behaviors.
How can i disable babel ?

I found a solution by clear babel config presets :

.configureBabel(config => {
        config.presets = [];
})

Hmm, that's clever. I think we should document that :)

@weaverryan Yes, it works fine for me , but one thing that we must notice, when you disable babel, you must target TypeScript to ES5 at most , because of Uglify in build in production env.

If you target TypeScript build to after ES5 Uglify may error on somethings like Arrow Functions !
Uglify ES6 support issue in Webpack repo : Issue

Note: the Uglify part of this issue should not be a problem in the latest version of Encore

Cheers!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MatthD picture MatthD  路  4Comments

Growiel picture Growiel  路  4Comments

JohnnyEvo picture JohnnyEvo  路  3Comments

Aerendir picture Aerendir  路  4Comments

EliuTimana picture EliuTimana  路  4Comments