Skip to content

Commit 2937265

Browse files
Zachery Thomas RichardetZachery Thomas Richardet
authored andcommitted
fix some more issues in the build process
1 parent 1459d82 commit 2937265

7 files changed

Lines changed: 43 additions & 67 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: npm install
3535

3636
- name: Build
37-
run: npm run build
37+
run: npm run build:prod
3838

3939
- name: Setup Pages
4040
uses: actions/configure-pages@v4
Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="">
33
<head>
4-
<meta charset="UTF-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>FTW Inference</title>
7-
<script type="module" crossorigin src="/assets/index-BwE9eBa4.js"></script>
8-
<link rel="stylesheet" crossorigin href="/assets/index-DjL0XJOT.css">
7+
<script type="module" crossorigin src="/build/assets/index-C5cWesqp.js"></script>
8+
<link rel="stylesheet" crossorigin href="/build/assets/index-DjL0XJOT.css">
99
</head>
1010
<body>
1111
<div id="app"></div>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"dev": "vite",
88
"dev:local": "vite --mode development",
99
"dev:staging": "vite --mode staging",
10-
"build": "run-p type-check \"build-only {@}\" --",
11-
"build-only": "vite build",
10+
"build": "vite build",
1211
"build:staging": "vite build --mode staging",
12+
"build:prod": "vite build --mode prod",
1313
"preview": "vite preview",
1414
"test:unit": "vitest",
1515
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"

vite.config.d.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

vite.config.js

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
11
import { fileURLToPath, URL } from 'node:url'
2-
import { defineConfig } from 'vite'
2+
import { defineConfig, loadEnv } from 'vite'
33
import vue from '@vitejs/plugin-vue'
44
import vueJsx from '@vitejs/plugin-vue-jsx'
55
import vueDevTools from 'vite-plugin-vue-devtools'
6+
67
// https://vitejs.dev/config/
7-
export default defineConfig({
8-
plugins: [vue(), vueJsx(), vueDevTools()],
9-
resolve: {
10-
alias: {
11-
'@': fileURLToPath(new URL('./src', import.meta.url)),
8+
export default defineConfig(({ mode }) => {
9+
// Load env file based on `mode` in the current directory.
10+
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
11+
const env = loadEnv(mode, process.cwd(), '')
12+
13+
return {
14+
plugins: [vue(), vueJsx(), vueDevTools()],
15+
resolve: {
16+
alias: {
17+
'@': fileURLToPath(new URL('./src', import.meta.url)),
18+
},
1219
},
13-
},
14-
build: {
15-
sourcemap: false,
16-
outDir: './build',
17-
emptyOutDir: true,
18-
},
19-
base: process.env.VITE_BASE_API_URL || '/',
20-
optimizeDeps: {
21-
include: ['ol/ol.css'],
22-
},
20+
base: mode === 'prod' ? '/build' : '/',
21+
build: {
22+
sourcemap: false,
23+
outDir: './build',
24+
emptyOutDir: true,
25+
},
26+
optimizeDeps: {
27+
include: ['ol/ol.css'],
28+
},
29+
server: {
30+
port: 5173,
31+
host: true,
32+
proxy: {
33+
'/api': {
34+
target: env.VITE_API_BASE_URL,
35+
changeOrigin: true,
36+
rewrite: (path) => path.replace(/^\/api/, ''),
37+
},
38+
},
39+
},
40+
}
2341
})

vite.config.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)