https://github.com/canvg/canvg/pull/1046#discussion_r423445163
Lookup @babel/plugin-transform-runtime over babelrc and presets.
With babelHelpers: 'runtime' @rollup/plugin-babel lookup @babel/plugin-transform-runtime only in plugin options, but plugin-transform-runtime is included in preset (or in babelrc).
src/index.ts ā lib/index.js, lib/index.es.js...
[!] (plugin babel) Error: You must use the `@babel/plugin-transform-runtime` plugin when `babelHelpers` is "runtime".
node_modules/regenerator-runtime/runtime.js
Error: You must use the `@babel/plugin-transform-runtime` plugin when `babelHelpers` is "runtime".
at error (/Users/dangreen/github/canvg/node_modules/rollup/dist/shared/node-entry.js:5400:30)
at throwPluginError (/Users/dangreen/github/canvg/node_modules/rollup/dist/shared/node-entry.js:11878:12)
at Object.error (/Users/dangreen/github/canvg/node_modules/rollup/dist/shared/node-entry.js:12912:24)
at Object.error (/Users/dangreen/github/canvg/node_modules/rollup/dist/shared/node-entry.js:12081:38)
at preflightCheck (/Users/dangreen/github/canvg/node_modules/@rollup/plugin-babel/dist/index.js:188:11)
error Command failed with exit code 1.
I encountered the same problem
rollup.config.js
import babel, { getBabelOutputPlugin } from '@rollup/plugin-babel'
export default {
input: './index.js',
output: {
format: 'umd',
dir: 'dist'
},
plugins: [
getBabelOutputPlugin({
configFile: path.resolve(__dirname, '.babelrc'),
allowAllFormats: true
}),
babel({
babelHelpers: 'runtime'
})
]
}
.babelrc
{
"presets": [
"@babel/preset-env"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{ "loose": true }
],
[
"@babel/plugin-transform-runtime",
{ "corejs": 2 }
]
]
}
./index.js ā dist...
[!] (plugin babel) Error: You must use the `@babel/plugin-transform-runtime` plugin when `babelHelpers` is "runtime".
node_modules/@babel/runtime-corejs2/core-js/promise.js
I found a configuration method to avoid this error
babel({
babelHelpers: 'runtime',
skipPreflightCheck: true
})
but how do you compile the dependencies of babel runtime to a file? :(
@dangreen A link to a PR is not a proper reproduction.
Citing the issue template:
Issues without minimal reproductions will be closed! Please provide one by:
- Using the REPL.it plugin reproduction template at https://repl.it/@rollup/rollup-plugin-repro
- Provide a minimal repository link (Read https://git.io/fNzHA for instructions).
These may take more time to triage than the other options.- Using the REPL at https://rollupjs.org/repl/
Please add a reproduction and we'll be happy to triage further. Given there's a workaround already posted, we'll leave this open, but the rollup team won't triage this until a proper repro is added.
@shellscape https://repl.it/repls/IckyBrightCache
Ran into this too while updating dependencies. Happy to push the WIP branch if it helps
@shellscape looks like @dangreen provided a reproduction. Does that suffice? Is there anything else you need from us?
A PR would be amazing. I'm not the sole contributor here and I haven't worked on the Babel plugin.
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ā
I'm still getting this.
Most helpful comment
I found a configuration method to avoid this error
but how do you compile the dependencies of babel runtime to a file? :(