I'm trying to use the babel-loader
with the babel-plugin-transform-runtime
.
I've followed the instructions at: https://github.com/babel/babel-loader#babel-is-injecting-helpers-into-each-file-and-bloating-my-code
The relevant 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']
}
}
}
]
And I get the following error on build:
Module build failed: Error: Cannot find module '@babel/plugin-transform-runtime'
If I'm changing the plugin name to: plugins: ['transform-runtime']
, I get the following error:
Module build failed: TypeError: this.setDynamic is not a function
What is the problem?