1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-06 16:00:28 +01:00

Thinking of adding Electron.js

This commit is contained in:
Donald Zou 2024-08-10 00:25:25 -04:00
parent a352a94d8a
commit fd3fc66bfc
6 changed files with 90 additions and 54 deletions

2
.gitignore vendored
View File

@ -49,4 +49,4 @@ coverage
*.tsbuildinfo
proxy.js
.vite/*
.vite/*

View File

@ -28,4 +28,4 @@ coverage
*.tsbuildinfo
.vite/*
.electron/*
electron

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
{
"name": "app",
"version": "0.0.0",
"version": "4.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build electron": "vite build --mode electron",
"preview": "vite preview"
},
"dependencies": {

View File

@ -5,27 +5,62 @@ import {proxy} from "./proxy.js";
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
base: "/static/app/dist",
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
export default defineConfig(({mode}) => {
if (mode === 'production'){
return {
base: "/static/app/dist",
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server:{
proxy: {
'/api': proxy
}
},
build: {
outDir: 'dist',
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`
}
}
}
}
},
server:{
proxy: {
'/api': proxy
}
},
build: {
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`
}
if (mode === 'electron'){
return {
emptyOutDir: false,
base: './',
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server:{
proxy: {
'/api': proxy
}
},
build: {
outDir: 'electron',
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`
}
}
}
}
}