Skip to content

UMD package will not run without process.env.NODE_ENV set #421

@twisty

Description

@twisty

If process.env.NODE_ENV is not set, the umd build throws an error when run in browser.

react-is.development.js:14 Uncaught ReferenceError: process is not defined
    at react-is.development.js:14
    at createCommonjsModule (formsy-react.umd.js:248)
    at react-is.production.min.js:15
    at formsy-react.umd.js:4
    at formsy-react.umd.js:5

This prevents us from easily loading the library from cdns like unpkg.

It's possible to workaround by adding a mock process object on the window object before loading the library:

window.process = {
  env: {
    NODE_ENV: ''
  }
}

See https://codepen.io/twisty/full/dyodZZG

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions