Skip to content

Commit 60a4708

Browse files
committed
fix: do not error on unresolved commonjs externals
fix #1339
1 parent 804c9a3 commit 60a4708

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/vite/src/node/build.ts

+6
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ export function onRollupWarning(
362362
const id = warning.source
363363
const importer = warning.importer
364364

365+
if (importer && /\?commonjs-external$/.test(importer)) {
366+
// allow commonjs external...
367+
warning.message = chalk.yellow(warning.message)
368+
return doWarn()
369+
}
370+
365371
if (id && isBuiltin(id)) {
366372
let importingDep
367373
if (importer) {

0 commit comments

Comments
 (0)