mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-30 02:36:11 +00:00
b7d7d9bcf3
- fix types - update defintion to map `UserConfig` type
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
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: UserConfig = {
|
|
plugins: [
|
|
tsconfigPaths(),
|
|
minifyJsonPlugin(["images", "battle-anims"], true)
|
|
],
|
|
clearScreen: false,
|
|
appType: "mpa",
|
|
build: {
|
|
minify: 'esbuild',
|
|
sourcemap: false,
|
|
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);
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
|
|
export default defineConfig(({mode}) => {
|
|
const envPort = Number(loadEnv(mode, process.cwd()).VITE_PORT);
|
|
|
|
return ({
|
|
...defaultConfig,
|
|
esbuild: {
|
|
pure: mode === 'production' ? ['console.log'] : [],
|
|
keepNames: true,
|
|
},
|
|
server: {
|
|
port: !isNaN(envPort) ? envPort : 8000,
|
|
}
|
|
});
|
|
});
|