【发布时间】:2018-06-30 04:17:27
【问题描述】:
我正在尝试将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
有什么问题?
【问题讨论】:
标签: javascript webpack babel-loader