Make it so that I can test the prod build locally easier

This commit is contained in:
Oliver-Akins 2025-05-31 00:50:20 -06:00
parent d888a0c9be
commit c23a656574
2 changed files with 12 additions and 4 deletions

View file

@ -7,8 +7,8 @@
"lint:nofix": "eslint",
"dev": "NODE_ENV=development vite build --mode dev --watch",
"dev:once": "NODE_ENV=development vite build --mode dev",
"staging": "NODE_ENV=staging vite build --mode dev --watch",
"staging:once": "NODE_ENV=staging vite build --mode dev",
"staging": "NODE_ENV=staging vite build --mode staging --watch",
"staging:once": "NODE_ENV=staging vite build --mode staging",
"build": "NODE_ENV=production vite build --mode prod"
},
"devDependencies": {

View file

@ -92,7 +92,11 @@ function copyFile(filepath, targetPath) {
// MARK: config
export default defineConfig(({ mode }) => {
const isProd = mode === `prod`;
const isProd = [`prod`, `staging`].includes(mode);
let outMode = mode;
if (mode === `staging`) {
outMode = `dev`;
};
const plugins = [
copyFile(`LICENSE`, `LICENSE`),
@ -125,6 +129,10 @@ export default defineConfig(({ mode }) => {
mode: isProd ? `production` : `development`,
build: {
minify: isProd ? `terser` : false,
terserOptions: {
keep_classnames: true,
keep_fnames: true,
},
sourcemap: true,
rollupOptions: {
input: {
@ -136,7 +144,7 @@ export default defineConfig(({ mode }) => {
format: `esm`,
},
},
outDir: `${mode}.dist`,
outDir: `${outMode}.dist`,
emptyOutDir: true,
},
};