-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(js): do not generate root babel.config.json for babel projects #17289
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
c23ca90
to
04135ff
Compare
@@ -71,36 +71,6 @@ export async function libraryGenerator(host: Tree, rawOptions: Schema) { | |||
); | |||
addTsConfigPath(host, `${options.importPath}/server`, [serverEntryPath]); | |||
|
|||
updateJson( |
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 never worked well, and the user should already have emotion and styled-components in the app. As per this PR (#17286) the app's babel config will now be applied to the libs as well. You never want to be in a situation where different styling solutions are used between apps and libs without a build step in the lib to normalize to CSS or something.
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.
We'll need a follow-up PR to enable emotion and styled-components in SWC for Next.js since they've added some early support for them.
04135ff
to
9ee6a36
Compare
if (host.exists(joinPathFragments(options.projectRoot, '.babelrc'))) { | ||
host.delete(joinPathFragments(options.projectRoot, '.babelrc')); | ||
} | ||
if (options.compiler === 'babel') { |
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.
Inlined the .babelrc creation here rather than in the files folder.
0879035
to
dd012fc
Compare
dd012fc
to
e436e39
Compare
e436e39
to
bfaadf5
Compare
bfaadf5
to
6d2265e
Compare
6d2265e
to
5db0408
Compare
99466fe
to
e776a20
Compare
e776a20
to
ba5ad48
Compare
ba5ad48
to
75f4ac9
Compare
@@ -138,7 +138,7 @@ | |||
"type": "string", | |||
"description": "The compiler to use", | |||
"enum": ["babel", "swc"], | |||
"default": "babel" | |||
"default": "swc" |
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.
should this be babel
as well?
@@ -143,7 +143,7 @@ | |||
"type": "string", | |||
"description": "The compiler to use.", | |||
"enum": ["babel", "swc"], | |||
"default": "babel" | |||
"default": "swc" |
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.
should this be babel
75f4ac9
to
6f55dfc
Compare
6f55dfc
to
ca7af0b
Compare
ee2f0e2
to
8d180e3
Compare
8d180e3
to
755719a
Compare
755719a
to
a09425d
Compare
- Project will only use its .babelrc and ignore .babelrc of other projects (e.g. other libs) - For prevous behavior user can set `babelUpwardRootMode: true` for @nx/webpack:webpack or @nx/rollup:rollup executors
a09425d
to
b0a7cf5
Compare
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. |
This PR ensures that
babel.config.json
is not generated in new projects. The default behavior is to only apply.babelrc
file for individual projects and ignore its dependencies'.babelrc
files. The implication of not usingrootMode: upward
is that any babel presets/plugins needed by a a dependency also needs to be added to the dependent project's.babelrc
file.Additionally, anywhere that we can safely swap to SWC instead of Babel we will do so by default.
Notes
@nx/node
and@nx/express
do not support building projects using Babel, so thebabelJest
option is deprecated andswcJest
is added to generate Jest project with@swc/jest
(to speed up test compile).