Merge pull request #119 from phated/phated/remove-global-shim

fix: Remove global shim from browser build
This commit is contained in:
Jordi Baylina 2022-01-21 07:35:47 +01:00 committed by GitHub
commit 6f7577aecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

@ -1,6 +1,5 @@
import { nodeResolve } from "@rollup/plugin-node-resolve"; import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonJS from "@rollup/plugin-commonjs"; import commonJS from "@rollup/plugin-commonjs";
import inject from "@rollup/plugin-inject";
import virtual from "@rollup/plugin-virtual"; import virtual from "@rollup/plugin-virtual";
import replace from "@rollup/plugin-replace"; import replace from "@rollup/plugin-replace";
import visualizer from "rollup-plugin-visualizer"; import visualizer from "rollup-plugin-visualizer";
@ -25,8 +24,6 @@ export default {
crypto: empty, crypto: empty,
readline: empty, readline: empty,
ejs: empty, ejs: empty,
// Stub out a "global" module that we can inject later
global: empty,
}), }),
nodeResolve({ nodeResolve({
browser: true, browser: true,
@ -35,12 +32,10 @@ export default {
}), }),
commonJS(), commonJS(),
replace({ replace({
// The current default is false, but they are changing it next version
preventAssignment: false,
"process.browser": !!process.env.BROWSER "process.browser": !!process.env.BROWSER
}), }),
inject({
// Inject the "global" virtual module if we see any reference to `global` in the code
global: "global",
}),
visualizer(), visualizer(),
] ]
}; };

@ -51,7 +51,6 @@
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0", "@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-inject": "^4.0.2",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.1.0", "@rollup/plugin-node-resolve": "^11.1.0",
"@rollup/plugin-replace": "^2.3.4", "@rollup/plugin-replace": "^2.3.4",