mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-30 23:14:28 +08:00
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:
@@ -8,6 +8,8 @@
|
|||||||
content="width=device-width,initial-scale=1.0,user-scalable=no"
|
content="width=device-width,initial-scale=1.0,user-scalable=no"
|
||||||
/>
|
/>
|
||||||
<title>Geek-AI 创作助手</title>
|
<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>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -15,5 +17,6 @@
|
|||||||
<strong>请开启JavaScript支持</strong>
|
<strong>请开启JavaScript支持</strong>
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
8231
web/package-lock.json
generated
8231
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,9 +3,9 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vite",
|
||||||
"build": "vue-cli-service build",
|
"build": "vite build",
|
||||||
"lint": "vue-cli-service lint"
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@better-scroll/core": "^2.5.1",
|
"@better-scroll/core": "^2.5.1",
|
||||||
@@ -48,9 +48,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.18.6",
|
"@babel/core": "7.18.6",
|
||||||
"@babel/eslint-parser": "^7.12.16",
|
"@babel/eslint-parser": "^7.12.16",
|
||||||
"@vue/cli-plugin-babel": "~5.0.0",
|
"@vitejs/plugin-vue": "^5.2.4",
|
||||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
||||||
"@vue/cli-service": "~5.0.0",
|
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-vue": "^8.0.3",
|
"eslint-plugin-vue": "^8.0.3",
|
||||||
@@ -58,6 +56,7 @@
|
|||||||
"stylus": "^0.58.1",
|
"stylus": "^0.58.1",
|
||||||
"stylus-loader": "^7.0.0",
|
"stylus-loader": "^7.0.0",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.17",
|
||||||
|
"vite": "^6.3.5",
|
||||||
"webpack": "^5.90.3"
|
"webpack": "^5.90.3"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|||||||
27
web/vite.config.js
Normal file
27
web/vite.config.js
Normal 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user