Skip to content

Commit

Permalink
feat: auto-externalize built-in node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Feb 13, 2021
1 parent e8cd350 commit 866eb32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"browserslist": "^4.14.7",
"builtin-modules": "^3.2.0",
"chalk": "^4.1.0",
"concurrently": "^5.3.0",
"cosmiconfig": "^7.0.0",
Expand Down
5 changes: 4 additions & 1 deletion src/config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path')
const builtInModules = require('builtin-modules')
const {babel: rollupBabel} = require('@rollup/plugin-babel')
const commonjs = require('@rollup/plugin-commonjs')
const json = require('@rollup/plugin-json')
Expand Down Expand Up @@ -49,7 +50,9 @@ const defaultGlobals = Object.keys(pkg.peerDependencies || {}).reduce(

const deps = Object.keys(pkg.dependencies || {})
const peerDeps = Object.keys(pkg.peerDependencies || {})
const defaultExternal = umd ? peerDeps : deps.concat(peerDeps)
const defaultExternal = builtInModules.concat(
umd ? peerDeps : deps.concat(peerDeps),
)

const globals = parseEnv(
'BUILD_GLOBALS',
Expand Down

0 comments on commit 866eb32

Please sign in to comment.