pokerogue/vite.config.ts
Frederico Santos 8783fd81c7
Revert egg additive/multiplicative change and change endless biome rotation for every 5 waves. (#3415)
Co-authored-by: snoozbuster <snoozbuster@outlook.com>
2024-08-07 21:29:41 +01:00

42 lines
925 B
TypeScript

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