Skip to content

Commit

Permalink
fix: build preview
Browse files Browse the repository at this point in the history
  • Loading branch information
kuoruan committed Jan 23, 2024
1 parent 8636675 commit 3180516
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"private": true,
"type": "module",
"scripts": {
"serve": "vite",
"dev": "vite build --watch --mode dev",
"build": "vite build",
"serve": "vite preview",
"lint": "eslint --ext .js,.cjs,.vue .",
"lint:fix": "eslint --fix --ext .js,.cjs,.vue ."
},
Expand Down
11 changes: 4 additions & 7 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ if (fs.existsSync(buildNumberFile)) {
buildNumber = +data || 0;
}

export default defineConfig(({ command }) => {
const isServe = command === "serve";
export default defineConfig(({ mode }) => {
const isDev = mode === "dev";

if (isServe) {
if (isDev) {
writeNewBuildNumber(++buildNumber);
}

Expand All @@ -40,9 +40,6 @@ export default defineConfig(({ command }) => {
"@": "/src",
},
},
server: {
port: 10010,
},
build: {
minify: false,
cssMinify: true,
Expand Down Expand Up @@ -70,7 +67,7 @@ export default defineConfig(({ command }) => {
banner({
content: (fileName) => {
return fileName.endsWith(".js")
? createBanner(isServe, buildNumber)
? createBanner(isDev, buildNumber)
: "";
},
verify: false,
Expand Down

0 comments on commit 3180516

Please sign in to comment.