8000 'main' cjs import has the wrong file name if NODE_ENV is production · Issue #1037 · immerjs/immer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
'main' cjs import has the wrong file name if NODE_ENV is production #1037
Closed
@mrdaniellewis

Description

@mrdaniellewis

🐛 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0