Make it so that I can test the prod build locally easier
This commit is contained in:
parent
d888a0c9be
commit
c23a656574
2 changed files with 12 additions and 4 deletions
|
|
@ -7,8 +7,8 @@
|
||||||
"lint:nofix": "eslint",
|
"lint:nofix": "eslint",
|
||||||
"dev": "NODE_ENV=development vite build --mode dev --watch",
|
"dev": "NODE_ENV=development vite build --mode dev --watch",
|
||||||
"dev:once": "NODE_ENV=development vite build --mode dev",
|
"dev:once": "NODE_ENV=development vite build --mode dev",
|
||||||
"staging": "NODE_ENV=staging vite build --mode dev --watch",
|
"staging": "NODE_ENV=staging vite build --mode staging --watch",
|
||||||
"staging:once": "NODE_ENV=staging vite build --mode dev",
|
"staging:once": "NODE_ENV=staging vite build --mode staging",
|
||||||
"build": "NODE_ENV=production vite build --mode prod"
|
"build": "NODE_ENV=production vite build --mode prod"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,11 @@ function copyFile(filepath, targetPath) {
|
||||||
|
|
||||||
// MARK: config
|
// MARK: config
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const isProd = mode === `prod`;
|
const isProd = [`prod`, `staging`].includes(mode);
|
||||||
|
let outMode = mode;
|
||||||
|
if (mode === `staging`) {
|
||||||
|
outMode = `dev`;
|
||||||
|
};
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
copyFile(`LICENSE`, `LICENSE`),
|
copyFile(`LICENSE`, `LICENSE`),
|
||||||
|
|
@ -125,6 +129,10 @@ export default defineConfig(({ mode }) => {
|
||||||
mode: isProd ? `production` : `development`,
|
mode: isProd ? `production` : `development`,
|
||||||
build: {
|
build: {
|
||||||
minify: isProd ? `terser` : false,
|
minify: isProd ? `terser` : false,
|
||||||
|
terserOptions: {
|
||||||
|
keep_classnames: true,
|
||||||
|
keep_fnames: true,
|
||||||
|
},
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
|
|
@ -136,7 +144,7 @@ export default defineConfig(({ mode }) => {
|
||||||
format: `esm`,
|
format: `esm`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
outDir: `${mode}.dist`,
|
outDir: `${outMode}.dist`,
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue