use*_*291 6 javascript webpack babeljs
插件的选项.babelrc如下:
{
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
]
}
Run Code Online (Sandbox Code Playgroud)
由于我不想使用.babelrc,但我打算只使用webpack.config.js,我需要在下面的文件中添加"polyfill": false和"regenerator": true选项,我webpack.config.js该怎么做呢.
var webpack=require('webpack')
module.exports = {
//configuration
context: __dirname + '/src/ui/',
entry: './ui.js',
module: {
loaders: [{
// "test" is commonly used to match the file extension
test: /\.jsx?$/,
// "exclude" should be used to exclude exceptions
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
plugins: ['react-html-attrs', 'transform-decorators-legacy',
'transform-class-properties', 'transform-runtime'],
}
}]
},
output: {
path: __dirname + '/src/public/js/',
filename: 'ui.bundle.js'
},
plugins: [],
};
Run Code Online (Sandbox Code Playgroud)
看起来这个修改webpack.config.js工程:
plugins: [
'react-html-attrs',
'transform-decorators-legacy',
'transform-class-properties',
['transform-runtime',{"polyfill": false, "regenerator": true}]
]
Run Code Online (Sandbox Code Playgroud)
看起来这个修改有效webpack.config.js:
plugins: [
'react-html-attrs',
'transform-decorators-legacy',
'transform-class-properties',
['transform-runtime',{"polyfill": false, "regenerator": true}]
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
489 次 |
| 最近记录: |