fix: mark Node.js built-in modules as external in rollup config (#7095)

Use `isBuiltin` from the `module` package to dynamically exclude all
Node.js built-in modules from the bundle, preventing rollup from
trying to bundle core modules like path, fs, crypto, etc.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lohit
2026-02-10 12:55:38 +00:00
committed by GitHub
parent ffa3509e8e
commit 00a59840fb

View File

@@ -5,6 +5,7 @@ const dts = require('rollup-plugin-dts');
const { terser } = require('rollup-plugin-terser');
const peerDepsExternal = require('rollup-plugin-peer-deps-external');
const json = require('@rollup/plugin-json');
const { isBuiltin } = require('module');
const packageJson = require('./package.json');
module.exports = [
@@ -38,6 +39,6 @@ module.exports = [
typescript({ tsconfig: './tsconfig.json' }),
terser()
],
external: ['axios', 'qs', 'ws', 'debug']
external: (id) => isBuiltin(id) || ['axios', 'qs', 'ws', 'debug'].includes(id)
}
];