-
-
Notifications
You must be signed in to change notification settings - Fork 849
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
'main' cjs import has the wrong file name if NODE_ENV is production #1037
Comments
Whoops, that's half my fault. I think I had tweaked the filenames and wrote the |
🎉 This issue has been resolved in version 10.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
How do you include immer via CDN now? |
There's now an ESM module that you can use: https://unpkg.com/browse/immer@10.0.1/dist/immer.production.mjs What's your use case for loading Immer (or anything else) from a CDN? |
Ease of use, it's how I'm used to using external libraries, cross-site caching? Should I just bundle it from now on? |
As far as I know, cross-site caching died a few years ago when browsers changed cache implementations due to security concerns. Generally, the "modern" way to do non-bundled JS apps is to load everything as ES modules. But yes, bundling certainly simplifies the deployment and loading steps. |
🐛 Bug Report
If you import immer using
require
andNODE_ENV
is set to "production", then the import fails.The build is referencing the wrong file name.
The file
./immer.cjs.production.min.js
does not exist. It is called./immer.cjs.production.js
. That is, without themin
.To Reproduce
const { produce } = require('immer');
Make sure
NODE_ENV === 'production'
Observed behaviour
Error
Cannot find module './immer.cjs.production.min.js'
Expected behaviour
I expected to import immer.
Environment
We only accept bug reports against the latest Immer version.
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: