Skip to content
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(react): allow setting react preset to production when using custom BABEL_ENV #19148

Conversation

AgentEnder
Copy link
Member

Current Behavior

When setting a custom BABEL_ENV, the @nx/react babel preset will pass development: true to the react babel preset. This may not be desirable, if you know that you are running webpack in production mode as it can cause errors.

Expected Behavior

You can pass an option to force development: false

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Sep 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Sep 13, 2023 8:39pm

const reactPresetOptions: Record<string, string | boolean> = {
runtime: presetOptions.runtime ?? 'automatic',
development: env !== 'production',
development:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep the option development to match the @babel/preset-react option, so it's clear that it is an override.

So something like:

development: presetOptions.development ?? env !== 'production'

@AgentEnder AgentEnder force-pushed the feat/react/allow-babel-prod-without-env-prod branch from ba298c2 to 581c751 Compare September 13, 2023 20:38
@AgentEnder AgentEnder marked this pull request as ready for review September 13, 2023 20:39
@AgentEnder AgentEnder requested review from a team as code owners September 13, 2023 20:39
@AgentEnder AgentEnder enabled auto-merge (squash) September 13, 2023 20:40
@AgentEnder AgentEnder merged commit dc8b408 into nrwl:master Sep 13, 2023
15 checks passed
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants