Refactor project to use Vite: Remove Vue CLI configuration files and update package.json to integrate Vite for development and build processes. Adjust HTML structure for improved asset loading and streamline dependencies in package-lock.json.
This commit is contained in:
35
vite.config.js
Normal file
35
vite.config.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
|
||||
// Vite: wir halten es erstmal möglichst nah an der bisherigen Vue-CLI-Dev-Experience.
|
||||
// - Dev-Proxy /api -> Backend
|
||||
// - Build nach dist/ (wie gewohnt), danach copy-dist -> public/ (bestehender Deploy-Flow)
|
||||
export default defineConfig(({ mode }) => {
|
||||
const backendTarget = process.env.VITE_BACKEND_PROXY || 'http://torstens:3010';
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: 'localhost',
|
||||
port: Number(process.env.VITE_FRONTEND_PORT || process.env.FRONTEND_PORT || 8080),
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: backendTarget,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
sourcemap: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user