forked from pagefaultgames/pokerogue
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
39 lines (36 loc) · 1.13 KB
/
Copy pathvite.config.ts
File metadata and controls
39 lines (36 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { defineConfig, loadEnv, type Rollup, type 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: {
chunkSizeWarningLimit: 10000,
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,
base: "",
esbuild: {
pure: mode === "production" ? ["console.log"] : [],
keepNames: true,
},
server: {
port: !Number.isNaN(envPort) ? envPort : 8000,
},
};
});