Skip to content

Commit 866eb32

Browse files
committed
feat: auto-externalize built-in node modules
1 parent e8cd350 commit 866eb32

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
5656
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
5757
"browserslist": "^4.14.7",
58+
"builtin-modules": "^3.2.0",
5859
"chalk": "^4.1.0",
5960
"concurrently": "^5.3.0",
6061
"cosmiconfig": "^7.0.0",

src/config/rollup.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path')
2+
const builtInModules = require('builtin-modules')
23
const {babel: rollupBabel} = require('@rollup/plugin-babel')
34
const commonjs = require('@rollup/plugin-commonjs')
45
const json = require('@rollup/plugin-json')
@@ -49,7 +50,9 @@ const defaultGlobals = Object.keys(pkg.peerDependencies || {}).reduce(
4950

5051
const deps = Object.keys(pkg.dependencies || {})
5152
const peerDeps = Object.keys(pkg.peerDependencies || {})
52-
const defaultExternal = umd ? peerDeps : deps.concat(peerDeps)
53+
const defaultExternal = builtInModules.concat(
54+
umd ? peerDeps : deps.concat(peerDeps),
55+
)
5356

5457
const globals = parseEnv(
5558
'BUILD_GLOBALS',

0 commit comments

Comments
 (0)