fix/update vite.config.ts (#3531)

- fix types
- update defintion to map `UserConfig` type
This commit is contained in:
flx-sta 2024-08-13 23:24:49 +02:00 committed by GitHub
parent bcca218777
commit b7d7d9bcf3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 13 deletions

View File

@ -1,27 +1,27 @@
import { defineConfig, loadEnv } from 'vite'; import { defineConfig, loadEnv, Rollup, UserConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths'; import tsconfigPaths from 'vite-tsconfig-paths';
import { minifyJsonPlugin } from "./src/plugins/vite/vite-minify-json-plugin"; import { minifyJsonPlugin } from "./src/plugins/vite/vite-minify-json-plugin";
export const defaultConfig = { export const defaultConfig: UserConfig = {
plugins: [ plugins: [
tsconfigPaths() as any, tsconfigPaths(),
minifyJsonPlugin(["images", "battle-anims"], true) minifyJsonPlugin(["images", "battle-anims"], true)
], ],
clearScreen: false, clearScreen: false,
appType: "mpa",
build: { build: {
minify: 'esbuild' as const, minify: 'esbuild',
sourcemap: false, sourcemap: false,
},
rollupOptions: { rollupOptions: {
onwarn(warning, warn) { onwarn(warning: Rollup.RollupLog, defaultHandler: (warning: string | Rollup.RollupLog) => void) {
// Suppress "Module level directives cause errors when bundled" warnings // Suppress "Module level directives cause errors when bundled" warnings
if (warning.code === "MODULE_LEVEL_DIRECTIVE") { if (warning.code === "MODULE_LEVEL_DIRECTIVE") {
return; return;
} }
warn(warning); defaultHandler(warning);
},
}, },
}, },
appType: "mpa",
}; };