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