From b9e2754e17156046346cc4b5d31b5fea154c19cb Mon Sep 17 00:00:00 2001 From: Felipe Barso <77860630+aprendendofelipe@users.noreply.github.com> Date: Sun, 19 Jul 2026 02:16:51 -0300 Subject: [PATCH] fix(build): externalize Node.js built-in modules --- release-please-config.json | 1 + vite.lib.config.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/release-please-config.json b/release-please-config.json index a588d88f..49a5b38a 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -8,6 +8,7 @@ "packages/infra": {}, "packages/ui": {} }, + "extra-files": ["vite.lib.config.js"], "plugins": ["node-workspace"], "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": true, diff --git a/vite.lib.config.js b/vite.lib.config.js index 2ad39be0..e4c08340 100644 --- a/vite.lib.config.js +++ b/vite.lib.config.js @@ -1,8 +1,10 @@ import { readFileSync } from 'node:fs'; +import { builtinModules } from 'node:module'; export function getBaseConfig() { const pkg = JSON.parse(readFileSync('./package.json', 'utf-8')); const externalDeps = [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]; + const builtinExternals = [...builtinModules, ...builtinModules.map((m) => `node:${m}`)]; return { build: { @@ -12,7 +14,8 @@ export function getBaseConfig() { fileName: (format, entryName) => `${entryName}.${format === 'es' ? 'js' : 'cjs'}`, }, rollupOptions: { - external: (id) => externalDeps.some((dep) => id === dep || id.startsWith(`${dep}/`)), + external: (id) => + externalDeps.some((dep) => id === dep || id.startsWith(`${dep}/`)) || builtinExternals.includes(id), output: { externalLiveBindings: false, },