Babel rootMode:"upward" issue
See original GitHub issueI’ve recently attempted an upgrade of a decently sized monorepo I’ve successfully managed with Nx so far.
I followed the usual procedure in going from 9.2.3
to latest, and no apparent issues or warnings came up along the process.
Current Behavior
When I try to start
or build
any of the apps that are in the repo (or a newly created one, for what is worth) I always get the same issue:
ERROR in ./main.tsx
Module build failed (from /Users/alf/monorepopath/node_modules/babel-loader/lib/index.js):
Error: Babel was run with rootMode:"upward" but a root could not be found when searching upward from "/Users/alf/monorepopath/apps/testapp/src"
And I get a reference to the same error in relation to ./polyfills.ts
as well.
NOTE: Jest tests are running fine, Storybook instances for all libs in the same repo are building just fine too.
Expected Behavior
The app to run and build properly as it does on the same machine if I create a Nx Workspace from scratch.
Steps to Reproduce
Not sure how to reproduce, since it seems related to my existing setup. I am not entirely sure that qualifies as a “bug”, but I am posting here to see if anyone has similar issues or one of the Nx gurus can point me in the right direction for a fix…
Here’s what I’ve tried so far:
- remove
node_modules
andyarn.lock
and go for a fresh install -> same outcome - checked out the repo and tried the same on a different machine with different OS (Win 10) -> same outcome
- went through a side-by-side comparison between the ‘upgraded’ workspace and the newly created one, at least the package dependencies and workspace configuration, and couldn’t spot anything weird or unexpected.
Environment
MacOS 10.15.5 with Node 12.17.0
@nrwl/angular : Not Found
@nrwl/cli : 9.4.2
@nrwl/cypress : 9.4.2
@nrwl/eslint-plugin-nx : 9.4.2
@nrwl/express : Not Found
@nrwl/jest : 9.4.2
@nrwl/linter : 9.4.2
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : 9.4.2
@nrwl/schematics : Not Found
@nrwl/tao : 9.4.2
@nrwl/web : 9.4.2
@nrwl/workspace : 9.4.2
typescript : 3.9.5
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:14 (5 by maintainers)
Same issue, upgraded from 8.2 to 10.0. There was no
babel.config.json
created via migration. Did not find a migration that actually did it. Created it by hand (like @paustint’s one), works fine now.@alfonsobravi it looks like some of the babel versions are mismatched. At this point you wouldn’t need to install babel presets like env, react, typescript, since the Nx presets have them as dependencies.
Can folks try removing
@babel/*
packages from their dependencies and see if that helps? If you have any custom plugins that you’re relying on you can still keep them.