Skip to content

Instantly share code, notes, and snippets.

@pinkhominid
Last active October 8, 2022 11:13
Show Gist options
  • Save pinkhominid/350e4c7fff749ba0c9c44761d97489b5 to your computer and use it in GitHub Desktop.
Save pinkhominid/350e4c7fff749ba0c9c44761d97489b5 to your computer and use it in GitHub Desktop.
Browser workaround for missing process.env.NODE_ENV
// Hack for immer esm (see https://github.com/immerjs/immer/issues/557)
// and others that suffer the same
window.process = { ...window.process, env: { ...window?.process?.env, NODE_ENV: 'production' } };
{
"version": "1.0.0",
"name": "node-env-hack",
"main": "node-env-hack.js",
"description": "Browser workaround for missing process.env.NODE_ENV",
"author": "pinkhominid <pinkhominid@birdbomb.com>",
"license": "MIT",
"homepage": "https://gist.github.com/pinkhominid/350e4c7fff749ba0c9c44761d97489b5"
}
@pinkhominid
Copy link
Author

pinkhominid commented Dec 3, 2020

npm i gist:350e4c7fff749ba0c9c44761d97489b5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment