So far I haven't found any COMPLETE example on this. There are answers talking about babel-plugin-transform-strict-mode
, but no code about how it should be configured.
Can anybody provide a simple working code snippet for how to configure the babel loader to disable strict mode? Thanks
So far I haven't found any COMPLETE example on this. There are answers talking about babel-plugin-transform-strict-mode
, but no code about how it should be configured.
Can anybody provide a simple working code snippet for how to configure the babel loader to disable strict mode? Thanks
Share Improve this question asked Jul 29, 2016 at 17:16 stackoverflowerstackoverflower 4,07311 gold badges51 silver badges75 bronze badges 2- This is babel 6, so black list doesn't work anymore – stackoverflower Commented Jul 29, 2016 at 17:17
- How about using this preset? – robertklep Commented Jul 29, 2016 at 18:19
1 Answer
Reset to default 5I'll add a simple config below.
Also note that if you use ES6 syntax (like import instead of require), webpack will automatically add "use strict" as all ES6 modules are expected to be strict mode code.
var config = {
entry: {
home: buildBundle( 'home' ),
},
output: {
path: BUILD_DIR,
filename: '[name]-bundle.js'
},
module : {
loaders : [
{
test: /\.js?/,
include: APP_DIR,
use: {
loader: 'babel-loader',
options: {
"presets": [
['es2015', {modules: false}]
],
}
},
exclude: /node_modules/
},
]
},
};