Skip to content

Commit 8ccfce4

Browse files
authored
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.
1 parent c26506a commit 8ccfce4

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/jest-react/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"react": "^16.0.0",
2424
"react-test-renderer": "^16.0.0"
2525
},
26+
"dependencies": {
27+
"object-assign": "^4.1.1"
28+
},
2629
"files": [
2730
"LICENSE",
2831
"README.md",

packages/react-debug-tools/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"react": "^16.0.0"
3030
},
3131
"dependencies": {
32-
"error-stack-parser": "^2.0.2"
32+
"error-stack-parser": "^2.0.2",
33+
"object-assign": "^4.1.1"
3334
}
3435
}

scripts/rollup/build.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,10 @@ function getPlugins(
392392
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
393393
__EXPERIMENTAL__,
394394
}),
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(),
397399
// Apply dead code elimination and/or minification.
398400
isProduction &&
399401
closure(

0 commit comments

Comments
 (0)