feat: Migrate frontend build tool from Vue CLI to Vite

This commit includes the necessary changes to migrate the web application's frontend build system from vue-cli to Vite.

Key changes include:
- Installed Vite and @vitejs/plugin-vue.
- Removed vue-cli dependencies.
- Created vite.config.js with configurations for aliases, proxy, and dev server, based on the previous vue.config.js.
- Moved public/index.html to web/index.html and updated it for Vite.
- Updated package.json scripts to use Vite commands.

Note: Due to persistent Node.js environment issues, I could not test the application after these changes. Manual testing and potential debugging will be required to ensure everything works as expected.
This commit is contained in:
google-labs-jules[bot]
2025-05-25 09:32:50 +00:00
parent 521ca77541
commit 94a5187e75
4 changed files with 917 additions and 7355 deletions

View File

@@ -8,6 +8,8 @@
content="width=device-width,initial-scale=1.0,user-scalable=no"
/>
<title>Geek-AI 创作助手</title>
<!-- Add any global CSS files here if needed, e.g., <link rel="stylesheet" href="/css/global.css"> -->
<!-- Favicon can be linked here, e.g., <link rel="icon" href="/favicon.ico"> -->
</head>
<body>
@@ -15,5 +17,6 @@
<strong>请开启JavaScript支持</strong>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

8231
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,9 +3,9 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},
"dependencies": {
"@better-scroll/core": "^2.5.1",
@@ -48,9 +48,7 @@
"devDependencies": {
"@babel/core": "7.18.6",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vitejs/plugin-vue": "^5.2.4",
"autoprefixer": "^10.4.20",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
@@ -58,6 +56,7 @@
"stylus": "^0.58.1",
"stylus-loader": "^7.0.0",
"tailwindcss": "^3.4.17",
"vite": "^6.3.5",
"webpack": "^5.90.3"
},
"eslintConfig": {

27
web/vite.config.js Normal file
View File

@@ -0,0 +1,27 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
server: {
port: 8888,
proxy: {
'/api': {
target: process.env.VUE_APP_API_HOST || 'http://localhost:8080', // Fallback if env var is not set
changeOrigin: true,
ws: true,
},
'/static/upload/': {
target: process.env.VUE_APP_API_HOST || 'http://localhost:8080', // Fallback if env var is not set
changeOrigin: true,
},
},
},
});