diff --git a/package-lock.json b/package-lock.json index 21fb1467d1..95a63851f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7550,6 +7550,15 @@ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, "is-regex": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", @@ -11961,6 +11970,36 @@ "rollup-pluginutils": "^2.6.0" } }, + "rollup-plugin-external-globals": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-external-globals/-/rollup-plugin-external-globals-0.6.1.tgz", + "integrity": "sha512-mlp3KNa5sE4Sp9UUR2rjBrxjG79OyZAh/QC18RHIjM+iYkbBwNXSo8DHRMZWtzJTrH8GxQ+SJvCTN3i14uMXIA==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^4.0.0", + "estree-walker": "^2.0.1", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7" + }, + "dependencies": { + "@rollup/pluginutils": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.1.1.tgz", + "integrity": "sha512-clDjivHqWGXi7u+0d2r2sBi4Ie6VLEAzWMIkvJLnDmxoOhBYOTfzGbOQBA32THHm11/LiJbd01tJUpJsbshSWQ==", + "dev": true, + "requires": { + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" + } + }, + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + } + } + }, "rollup-plugin-ignore": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/rollup-plugin-ignore/-/rollup-plugin-ignore-1.0.9.tgz", diff --git a/package.json b/package.json index 5444025f90..ddb7353648 100644 --- a/package.json +++ b/package.json @@ -142,6 +142,7 @@ "rollup-plugin-alias": "^1.5.2", "rollup-plugin-babel": "^4.4.0", "rollup-plugin-commonjs": "^9.3.4", + "rollup-plugin-external-globals": "^0.6.1", "rollup-plugin-ignore": "^1.0.5", "rollup-plugin-istanbul": "^3.0.0", "rollup-plugin-json": "^3.1.0", diff --git a/rollup.config.js b/rollup.config.js index 858e3163c5..3ce6b6d5d5 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,6 +14,7 @@ import stub from 'rollup-plugin-stub'; import isCI from 'is-ci'; import replace from '@rollup/plugin-replace'; import istanbul from 'rollup-plugin-istanbul'; +import externalGlobals from 'rollup-plugin-external-globals'; const excludeCoverage = [ 'test/**', @@ -66,6 +67,11 @@ const primedBabel = babel({ ['@babel/plugin-transform-runtime', {regenerator: false}] ] }); +const primedExternalGlobals = externalGlobals({ + 'global': 'window', + 'global/window': 'window', + 'global/document': 'document' +}); const progress = () => { if (isCI) { @@ -77,9 +83,6 @@ const progress = () => { const globals = { browser: { - 'global': 'window', - 'global/window': 'window', - 'global/document': 'document' }, module: { }, @@ -132,6 +135,7 @@ export default cliargs => [ }), primedResolve, json(), + primedExternalGlobals, primedCjs, primedBabel, cliargs.progress !== false ? progress() : {} @@ -156,6 +160,7 @@ export default cliargs => [ }), primedResolve, json(), + primedExternalGlobals, primedCjs, primedBabel, cliargs.progress !== false ? progress() : {} @@ -242,6 +247,7 @@ export default cliargs => [ }), primedResolve, json(), + primedExternalGlobals, primedCjs, primedBabel, cliargs.progress !== false ? progress() : {} @@ -288,6 +294,7 @@ export default cliargs => [ plugins: [ primedResolve, json(), + primedExternalGlobals, primedCjs, primedBabel, cliargs.progress !== false ? progress() : {} @@ -310,6 +317,7 @@ export default cliargs => [ primedIgnore, primedResolve, json(), + primedExternalGlobals, primedCjs, primedBabel, cliargs.progress !== false ? progress() : {}