mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 14:25:32 +01:00
* Remove public folder to prepare for submodule * Add submodule and update licensing * Stop serving non-asset files during build * Update pull request template * Update CODEOWNERS * Add locales submodule * Update pull request template regarding locales * remove post-checkout lefthook in favor of git config * chore: add license info to new script * Update gh pages workflow * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * update assets
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2024-2025 Pagefault Games
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
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, command }) => {
|
|
const envPort = Number(loadEnv(mode, process.cwd()).VITE_PORT);
|
|
|
|
return {
|
|
...defaultConfig,
|
|
base: "",
|
|
publicDir: command === "serve" ? "assets" : false,
|
|
esbuild: {
|
|
pure: mode === "production" ? ["console.log"] : [],
|
|
keepNames: true,
|
|
},
|
|
server: {
|
|
port: !Number.isNaN(envPort) ? envPort : 8000,
|
|
},
|
|
};
|
|
});
|