admin管理员组文章数量:1324847
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/
},
]
},
};
本文标签: javascriptDisable babel strict mode from webpackconfigjsStack Overflow
版权声明:本文标题:javascript - Disable babel strict mode from webpack.config.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742148665a2422909.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论