Skip to content

Commit

Permalink
Only use Rollup's CommonJS plugin for "react-art" (#18186)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
sebmarkbage authored Feb 29, 2020
1 parent c26506a commit 8ccfce4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/jest-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"react": "^16.0.0",
"react-test-renderer": "^16.0.0"
},
"dependencies": {
"object-assign": "^4.1.1"
},
"files": [
"LICENSE",
"README.md",
Expand Down
3 changes: 2 additions & 1 deletion packages/react-debug-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"react": "^16.0.0"
},
"dependencies": {
"error-stack-parser": "^2.0.2"
"error-stack-parser": "^2.0.2",
"object-assign": "^4.1.1"
}
}
6 changes: 4 additions & 2 deletions scripts/rollup/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,10 @@ function getPlugins(
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
__EXPERIMENTAL__,
}),
// We still need CommonJS for external deps like object-assign.
commonjs(),
// The CommonJS plugin *only* exists to pull "art" into "react-art".
// I'm going to port "art" to ES modules to avoid this problem.
// Please don't enable this for anything else!
isUMDBundle && entry === 'react-art' && commonjs(),
// Apply dead code elimination and/or minification.
isProduction &&
closure(
Expand Down

0 comments on commit 8ccfce4

Please sign in to comment.