Skip to content

Commit

Permalink
fix: warn on build when bundling code that uses nodejs built in module (
Browse files Browse the repository at this point in the history
#12616)

Co-authored-by: bluwy <bjornlu.dev@gmail.com>
  • Loading branch information
chaxus and bluwy committed Apr 7, 2023
1 parent da38ad8 commit 72050f9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vite/src/node/plugins/resolve.ts
Expand Up @@ -382,6 +382,11 @@ export function resolvePlugin(resolveOptions: InternalResolveOptions): Plugin {
`externalized node built-in "${id}" to empty module. ` +
`(imported by: ${colors.white(colors.dim(importer))})`,
)
} else if (isProduction) {
this.warn(
`Module "${id}" has been externalized for browser compatibility, imported by "${importer}". ` +
`See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`,
)
}
return isProduction
? browserExternalId
Expand Down

0 comments on commit 72050f9

Please sign in to comment.