0
我無法使用webpack傳輸es6默認參數。
我目前的設置是:Webpack默認參數es6
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: ["./main.js"],
output: { path: __dirname, filename: './bundle.js'},
resolve: {
modules: [path.resolve('../js'), path.resolve('../js/node_modules')],
extensions: ['*', '.ts', '.js', '.jsx', '.es6']
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader' },
{
test: /(\.jsx?$|\.es6?$)/,
loader: 'babel-loader',
query: {
babelrc: false,
plugins: [
'transform-es2015-arrow-functions',
'transform-es2015-block-scoping'
],
presets: ['es2016', 'react']
},
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"',
'global': {}, // bizarre lodash(?) webpack workaround
'global.GENTLY': false // superagent client fix
})
],
target: "node"
};
https://babeljs.io/docs/plugins/transform-es2015-parameters/ –
好像你可能想用'通天預設-env',而不是硬編碼這個自己? – loganfsmyth