babel: preset-react v7 build error
Mentioning this error I have, since I haven’t found it in issues, while trying to update babel to use jsx fragments
I’m using a valid webpack config, running webpack fails with:
ERROR in ./app/index.js
Module build failed: TypeError: Cannot read property 'throwIfNamespace' of undefined (While processing preset: "/home/caub/dev/projX/node_modules/@babel/preset-react/lib/index.js")
at _default (/home/caub/dev/projX/node_modules/@babel/plugin-transform-react-jsx/lib/index.js:15:36)
.babelrc
{
"presets": [
"@babel/preset-react",
[
"@babel/preset-env",
{
"targets": {
"browsers": ["last 2 versions", "not ie > 0", "not Android > 0"]
}
}
]
]
}
package.json
"@babel/core": "^7.0.0-beta.32",
"@babel/preset-env": "^7.0.0-beta.32",
"@babel/preset-react": "^7.0.0-beta.32",
"@babel/preset-stage-3": "^7.0.0-beta.32",
software | version(s) |
---|---|
Babel | @7.0.0-beta.32 |
node | 9.2 |
npm | 5.5.1 |
Operating System | Linux |
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 20 (7 by maintainers)
Commits related to this issue
- fixes #6945 documentation change for 'loose' option in 'babel-plugin-transform-modules-commonjs' [skip-cli] — committed to perinikhil/babel by deleted user 7 years ago
- fixes #6945 documentation change for 'loose' option in 'babel-plugin-transform-modules-commonjs' [skip-ci] — committed to perinikhil/babel by deleted user 7 years ago
Working with these pacakges:
Thanks yes with babel-loader ^8.0.0-beta.0 it builds fine The only remaining points is to update eslint and editors (vscode, sublime) for fragments, even markdown parsers fail
also jest is throwing that
Cannot read property 'throwIfNamespace' of undefined
errorsymlinking babel-core to @babel/core can work or
npm i -D babel-core@7.0.0-bridge.0
(< might be helpful for @stephen-last)Yes using
babel-core@7.0.0-bridge.0
is required forbabel-jest
with Babel 7 because we renamed the package to@babel/core
and Jest expectsbabel-core
. The bridge package just passes through to@babel/core
.see my comment just above with
babel-core@7.0.0-bridge.0
babel-loader is using babel-core not
@babel/core
, you’ll have to usebabel-loader@8.0.0-beta.0
because it’s a breaking change for us otherwise to switch from@babel/core
andbabel-core
. although we could try the bridge package stillI’m using
babel-loader@8.0.0-beta.0
already…Currently searching for other deps that may use
babel-core
…