You've already forked zblade.dev
chore(astro): ignore false unused import build warning
Suppress Astro's remote helper warning during Rollup builds when it points to astro/dist/assets/utils/index.js.
This commit is contained in:
@@ -1,6 +1,27 @@
|
|||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
|
const shouldIgnoreAstroUnusedImportWarning = (warning) => {
|
||||||
|
return (
|
||||||
|
warning.code === 'UNUSED_EXTERNAL_IMPORT' &&
|
||||||
|
warning.exporter === '@astrojs/internal-helpers/remote' &&
|
||||||
|
warning.ids?.some((id) => id.includes('node_modules/astro/dist/assets/utils/index.js'))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://zblade.dev',
|
site: 'https://zblade.dev',
|
||||||
output: 'static',
|
output: 'static',
|
||||||
|
vite: {
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
onwarn(warning, warn) {
|
||||||
|
if (shouldIgnoreAstroUnusedImportWarning(warning)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
warn(warning);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user