Inject process env vars into ES6 bundle to fix crash

This commit is contained in:
Andrew Kingston 2022-09-07 08:48:29 +01:00
parent feda4e61c1
commit 0cf7845650
3 changed files with 28 additions and 0 deletions

View File

@ -39,6 +39,7 @@
"jest": "^26.6.3", "jest": "^26.6.3",
"marked": "^4.0.10", "marked": "^4.0.10",
"rollup": "^2.36.2", "rollup": "^2.36.2",
"rollup-plugin-inject-process-env": "^1.3.1",
"rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-node-resolve": "^5.2.0",

View File

@ -4,6 +4,7 @@ import json from "@rollup/plugin-json"
import { terser } from "rollup-plugin-terser" import { terser } from "rollup-plugin-terser"
import builtins from "rollup-plugin-node-builtins" import builtins from "rollup-plugin-node-builtins"
import globals from "rollup-plugin-node-globals" import globals from "rollup-plugin-node-globals"
import injectProcessEnv from "rollup-plugin-inject-process-env"
const production = !process.env.ROLLUP_WATCH const production = !process.env.ROLLUP_WATCH
@ -24,6 +25,9 @@ export default [
globals(), globals(),
builtins(), builtins(),
json(), json(),
injectProcessEnv({
NO_JS: process.env.NO_JS,
}),
production && terser(), production && terser(),
], ],
}, },

View File

@ -568,6 +568,15 @@
magic-string "^0.25.7" magic-string "^0.25.7"
resolve "^1.17.0" resolve "^1.17.0"
"@rollup/plugin-inject@^4.0.0":
version "4.0.4"
resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-4.0.4.tgz#fbeee66e9a700782c4f65c8b0edbafe58678fbc2"
integrity sha512-4pbcU4J/nS+zuHk+c+OL3WtmEQhqxlZ9uqfjQMQDOHOPld7PsCd8k5LWs8h5wjwJN7MgnAn768F2sDxEP4eNFQ==
dependencies:
"@rollup/pluginutils" "^3.1.0"
estree-walker "^2.0.1"
magic-string "^0.25.7"
"@rollup/plugin-json@^4.1.0": "@rollup/plugin-json@^4.1.0":
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3" resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3"
@ -3747,6 +3756,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^3.0.0" hash-base "^3.0.0"
inherits "^2.0.1" inherits "^2.0.1"
rollup-plugin-inject-process-env@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-inject-process-env/-/rollup-plugin-inject-process-env-1.3.1.tgz#2d7660fe76f2b221b976cb35597763ffcaad3db3"
integrity sha512-kKDoL30IZr0wxbNVJjq+OS92RJSKRbKV6B5eNW4q3mZTFqoWDh6lHy+mPDYuuGuERFNKXkG+AKxvYqC9+DRpKQ==
dependencies:
magic-string "^0.25.7"
rollup-plugin-node-builtins@^2.1.2: rollup-plugin-node-builtins@^2.1.2:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-node-builtins/-/rollup-plugin-node-builtins-2.1.2.tgz#24a1fed4a43257b6b64371d8abc6ce1ab14597e9" resolved "https://registry.yarnpkg.com/rollup-plugin-node-builtins/-/rollup-plugin-node-builtins-2.1.2.tgz#24a1fed4a43257b6b64371d8abc6ce1ab14597e9"
@ -3780,6 +3796,13 @@ rollup-plugin-node-resolve@^5.2.0:
resolve "^1.11.1" resolve "^1.11.1"
rollup-pluginutils "^2.8.1" rollup-pluginutils "^2.8.1"
rollup-plugin-polyfill-node@^0.10.2:
version "0.10.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.10.2.tgz#b2128646851fcb9475ddfd5bc22ca1a8c568738d"
integrity sha512-5GMywXiLiuQP6ZzED/LO/Q0HyDi2W6b8VN+Zd3oB0opIjyRs494Me2ZMaqKWDNbGiW4jvvzl6L2n4zRgxS9cSQ==
dependencies:
"@rollup/plugin-inject" "^4.0.0"
rollup-plugin-terser@^7.0.2: rollup-plugin-terser@^7.0.2:
version "7.0.2" version "7.0.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d"