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

Auto-freezing "turned off in production" ignores NODE_ENV=production #467

Closed
maranomynet opened this issue Nov 22, 2019 · 2 comments
Closed

Comments

@maranomynet
Copy link

maranomynet commented Nov 22, 2019

It seems to me that the auto-freezing doesn't depend on NODE_ENV but somehow relies on uglifyjs/terser's dead code removal to disable the auto-freezing.

My dev build happened to be minified so errors were suppressed, but an unminified production build* crashed.

This was a jarring realization to me.

--

* Don't ask. Good story. You had to be there.

@mweststrate
Copy link
Collaborator

The default config is

immer/src/immer.js

Lines 29 to 32 in dbedded

autoFreeze:
typeof process !== "undefined"
? process.env.NODE_ENV !== "production"
: verifyMinified.name === "verifyMinified",

Are you sure process.env.NODE_ENV is properly configured and picked up by your bundler?

@mweststrate
Copy link
Collaborator

Closing this issue since it is doesn't look actionable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants