Skip to content

Commit c106f42

Browse files
committed
build(vite): suppress UNUSED_EXTERNAL_IMPORT warnings from node_modules via onwarn
1 parent 36f60aa commit c106f42

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

astro.config.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ export default defineConfig({
1212
vite: {
1313
build: {
1414
sourcemap: false,
15+
rollupOptions: {
16+
onwarn(warning, defaultHandler) {
17+
// Silence unused external import warnings originating from node_modules
18+
if (
19+
warning &&
20+
warning.code === "UNUSED_EXTERNAL_IMPORT" &&
21+
typeof warning.id === "string" &&
22+
warning.id.includes("node_modules")
23+
) {
24+
return;
25+
}
26+
defaultHandler(warning);
27+
},
28+
},
1529
},
1630
css: {
1731
devSourcemap: false,

0 commit comments

Comments
 (0)