Closed
Description
🐛 Bug Report
If you import immer using require
and NODE_ENV
is set to "production", then the import fails.
The build is referencing the wrong file name.
// This is the contents of dist/cjs/index.js in your npm package
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./immer.cjs.production.min.js')
} else {
module.exports = require('./immer.cjs.development.js')
}
The file ./immer.cjs.production.min.js
does not exist. It is called ./immer.cjs.production.js
. That is, without the min
.
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.
- Immer version:
- I filed this report against the latest version of Immer
- Occurs with
setUseProxies(true)
- Occurs with
setUseProxies(false)
(ES5 only)