Options of a plug-in on .babelrc
are like below:
{
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
]
}
Since I don't want to use .babelrc
, but I intend to only use webpack.config.js
, I need to add "polyfill": false
and "regenerator": true
options to my webpack.config.js
file below, How can I do that.
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: [],
};
Looks like this modification on webpack.config.js
works:
plugins: [
'react-html-attrs',
'transform-decorators-legacy',
'transform-class-properties',
['transform-runtime',{"polyfill": false, "regenerator": true}]
]
Looks like this modification on webpack.config.js<\/code> works:
plugins: [
'react-html-attrs',
'transform-decorators-legacy',
'transform-class-properties',
['transform-runtime',{"polyfill": false, "regenerator": true}]
]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.