-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
37 lines (35 loc) · 1.28 KB
/
vite.config.js
File metadata and controls
37 lines (35 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { defineConfig } from 'vite';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
export default defineConfig({
root: 'frontend', // ← treat `frontend/` as your project root
base: '/static/dist/', // ← ensure chunks load from Flask static
resolve: {
alias: {
'@': resolve(__dirname, 'frontend') // ← lets you import modules via "@/utils.js" etc.
},
extensions: ['.js']
},
build: {
outDir: '../app/static/dist', // ← emit into Flask’s `static/dist/`
emptyOutDir: true,
cssCodeSplit: false, // ← bundle *all* your SCSS into single style.css
rollupOptions: {
input: {
main: resolve(__dirname, 'frontend/main.js'),
submitPhoto: resolve(__dirname, 'frontend/submit_photo_entry.js'),
sw: resolve(__dirname, 'frontend/sw.js')
},
output: {
entryFileNames: '[name].js', // → main.js & submitPhoto.js
chunkFileNames: 'chunk-[hash].js',
assetFileNames: '[name][extname]' // → style.css (no hash)
}
}
},
server: {
// if you want to test dev against Flask backend:
// proxy: { '/': 'http://localhost:5000' }
}
});