-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(webpack): add babelUpwardRootMode #15061
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
efe04a3
to
d256073
Compare
d256073
to
54ebc96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the following flow:
npx nx g @nrwl/react:app my-react-app
npx nx build my-react-app # fails due to .babelrc is missing in src/.babelrc (generated .babelrc is in project root rather than source root)
-> Fix: turn on babelUpwardRootMode: true
in build
target
The @nrwl/js
code (that gets deleted) might need to readjust but I think it still needs to be there. The following flow fails:
npx nx g @nrwl/js:lib my-js-lib
use myJsLib()
in my-react-app
npx nx build my-react-app # fails due to my-js-lib is missing babelrc
--> Fix: add .babelrc
manually or generate a lib with --include-babel-rc
54ebc96
to
57a7371
Compare
57a7371
to
2675278
Compare
@nartc thanks for the review. It was a stupid typo on my end, instead of project root, I used src root to specify the location of the project's The reason behind this PR is to remove |
2675278
to
af38a6b
Compare
af38a6b
to
384aca5
Compare
384aca5
to
0b5d234
Compare
0b5d234
to
0753b56
Compare
0753b56
to
ba31145
Compare
(cherry picked from commit 5d54f71)
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
If you try to import a js library in a
@nrwl/webpack:webpack
project, then the build fails, unless your library contains a.babelrc
file. This is due to therootmode: 'upward'
setting that's used in the webpack executor.Expected Behavior
Libraries that don't specifically need a
.babelrc
, should not require one.In this PR, we are adding a flag to allow users to set
rootmode: 'upward'
if they need to, and only in that case we are usingrootmode: 'upward'
in the webpack executor. In the other cases, we are setting the.babelrc
path to be that of the parent app we are building, so that the executor will not look elsewhere for a.babelrc
file.Related Issue(s)
Fixes #14807