Only use Rollup's CommonJS plugin for "react-art" (#18186)
* Only use Rollup's CommonJS plugin for "react-art" We still need it for the "art" UMD builds but nothing else should have CommonJS dependencies anymore. * react-debug-tools and jest-react should leave object-assign as an external dep This avoids it being compiled into the output.
Sebastian Markbåge committed
Feb 28, 2020 at 16:46 UTC
8ccfce460f141299d61290f877745407e05e531e
3 files changed
+9
-3
packages/jest-react/package.json
+3
@@ -23,6 +23,9 @@
23
"react": "^16.0.0",
24
"react-test-renderer": "^16.0.0"
25
},
26
+ "dependencies": {
27
+ "object-assign": "^4.1.1"
28
+ },
29
"files": [
30
"LICENSE",
31
"README.md",
packages/react-debug-tools/package.json
+2
-1
@@ -29,6 +29,7 @@
29
"react": "^16.0.0"
30
},
31
"dependencies": {
32
- "error-stack-parser": "^2.0.2"
32
+ "error-stack-parser": "^2.0.2",
33
+ "object-assign": "^4.1.1"
34
}
35
}
scripts/rollup/build.js
+4
-2
@@ -392,8 +392,10 @@ function getPlugins(
392
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
393
__EXPERIMENTAL__,
394
}),
395
- // We still need CommonJS for external deps like object-assign.
396
- commonjs(),
395
+ // The CommonJS plugin *only* exists to pull "art" into "react-art".
396
+ // I'm going to port "art" to ES modules to avoid this problem.
397
+ // Please don't enable this for anything else!
398
+ isUMDBundle && entry === 'react-art' && commonjs(),
399
// Apply dead code elimination and/or minification.
400
isProduction &&
401
closure(