parcel: Cannot find module 'babel-runtime....'
parcel verion 1.3.1
I upgraded the version, and then the error occurred
.babelrc
{
"presets": [
"react",
"es2015",
"stage-0"
],
"plugins": [
"babel-plugin-transform-decorators-legacy",
"babel-plugin-transform-runtime"
]
}
Uncaught Error: Cannot find module 'babel-runtime/core-js/symbol/to-primitive'
at newRequire (ccfdca706170b05661250a9fa899b9e8.js:32)
at localRequire (ccfdca706170b05661250a9fa899b9e8.js:47)
at Object.require.10 (ccfdca706170b05661250a9fa899b9e8.js:18751)
at newRequire (ccfdca706170b05661250a9fa899b9e8.js:41)
at localRequire (ccfdca706170b05661250a9fa899b9e8.js:47)
at Object.require.3.babel-runtime/core-js/object/define-property (ccfdca706170b05661250a9fa899b9e8.js:22245)
at newRequire (ccfdca706170b05661250a9fa899b9e8.js:41)
at localRequire (ccfdca706170b05661250a9fa899b9e8.js:47)
at Object.require.2.react (ccfdca706170b05661250a9fa899b9e8.js:22316)
at newRequire (ccfdca706170b05661250a9fa899b9e8.js:41)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Always parse dependencies if babel ran. Fixes #408. A babel plugin might introduce a new dependency, e.g. transform-runtime. — committed to parcel-bundler/parcel by devongovett 7 years ago
- Disable babelrc when building only modules syntax Fixes #408. — committed to parcel-bundler/parcel by devongovett 6 years ago
- Always parse dependencies if babel ran. Fixes #408. A babel plugin might introduce a new dependency, e.g. transform-runtime. — committed to parcel-bundler/parcel by devongovett 7 years ago
- Disable babelrc when building only modules syntax Fixes #408. — committed to parcel-bundler/parcel by devongovett 6 years ago
Ok that was a separate issue, where some node module used ES6 module syntax instead of commonjs, probably via package.json
module
field. We run babel-plugin-transform-es2015-modules-commonjs to convert those to commonjs, but babel was also traversing up to your project to find a babelrc and thus enabling the transform-runtime plugin as well. 1a853be disables babelrc detection when only compiling es6 modules to commonjs. Let me know if it fixes your problem. I’ll get a release to npm out shortly.@devongovett Can we reopen this issue?
Yeah, I am getting this with a module that needs the babel-runtime.
I give up using
transform-runtime
and usebabel-polyfill
instead. Everything goes well so far. @Topthinking+1, but I have tried 1.2.1 and it’s still throwing this error. First time using parcel.
Seems
babel-runtime
isn’t bundled to js file in browser, it throws error when evaluatingmodules[name]
innewRequire()
. Thename
is a string like"babel-runtime/core-js/***"
, not a number-index.package.json
.babelrc