diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index c1c91bd61500e1..bef7fd941d5d43 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -362,6 +362,12 @@ export function onRollupWarning( const id = warning.source const importer = warning.importer + if (importer && /\?commonjs-external$/.test(importer)) { + // allow commonjs external... + warning.message = chalk.yellow(warning.message) + return doWarn() + } + if (id && isBuiltin(id)) { let importingDep if (importer) {