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

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

Open
twisty opened this issue Mar 11, 2020 · 0 comments
Open

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

twisty opened this issue Mar 11, 2020 · 0 comments

Comments

@twisty
Copy link
Member

twisty commented Mar 11, 2020

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

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