2
如何配置Babel和Webpack以在一個項目中加載ES6源代碼和ES5供應商庫,例如:jQuery和舊的lib javascript文件?它們都具有相同的* .js擴展名。如何配置Webpack和Babel以在一個項目中使用ES5和ES6
{
test: /\.js$/,
loader: 'babel',
include: projectRoot,
exclude: /node_modules/
},
以上裝載機將正確加載ES6,但把所有的JS文件作爲ES6。那我在ES5中的舊的lib js文件呢?
這裏是我的.babelrc文件:
{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime"],
"comments": false
}