我正在尝试babel-loader
与babel-plugin-transform-runtime
.
我已按照以下说明操作: https ://github.com/babel/babel-loader#babel-is-injecting-helpers-into-each-file-and-bloating-my-code
相关代码:
rules: [
// the 'transform-runtime' plugin tells babel to require the runtime
// instead of inlining it.
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/transform-runtime']
}
}
}
]
我在构建时收到以下错误:
Module build failed: Error: Cannot find module '@babel/plugin-transform-runtime'
如果我将插件名称更改为: plugins: ['transform-runtime']
,我会收到以下错误:
Module build failed: TypeError: this.setDynamic is not a function
问题是什么?