Skip to content

Commit 1375461

Browse files
committed
feat: vite.config.js变量抽离,插件优化
1 parent 7081e3a commit 1375461

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Diff for: web/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@
2121
"@wangeditor/editor": "^5.1.23",
2222
"@wangeditor/editor-for-vue": "^5.1.12",
2323
"ace-builds": "^1.36.4",
24-
"axios": "^1.7.7",
24+
"axios": "1.8.2",
2525
"chokidar": "^4.0.0",
2626
"core-js": "^3.38.1",
2727
"echarts": "5.5.1",
2828
"element-plus": "^2.8.5",
2929
"highlight.js": "^11.10.0",
30+
"install": "^0.13.0",
3031
"marked": "14.1.1",
3132
"marked-highlight": "^2.1.4",
3233
"mitt": "^3.0.1",
34+
"npm": "^11.3.0",
3335
"nprogress": "^0.2.0",
3436
"path": "^0.12.7",
3537
"pinia": "^2.2.2",

Diff for: web/vite.config.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ export default ({ mode }) => {
4242
}
4343
}
4444

45+
const base = "/"
46+
const root = "./"
47+
const outDir = "dist"
48+
4549
const config = {
46-
base: '/', // 编译后js导入的资源路径
47-
root: './', // index.html文件所在位置
50+
base: base, // 编译后js导入的资源路径
51+
root: root, // index.html文件所在位置
4852
publicDir: 'public', // 静态资源文件夹
4953
resolve: {
5054
alias
@@ -79,7 +83,7 @@ export default ({ mode }) => {
7983
minify: 'terser', // 是否进行压缩,boolean | 'terser' | 'esbuild',默认使用terser
8084
manifest: false, // 是否产出manifest.json
8185
sourcemap: false, // 是否产出sourcemap.json
82-
outDir: 'dist', // 产出目录
86+
outDir: outDir, // 产出目录
8387
terserOptions: {
8488
compress: {
8589
//生产环境时移除console
@@ -105,8 +109,7 @@ export default ({ mode }) => {
105109
]
106110
}),
107111
vuePlugin(),
108-
svgBuilder('./src/assets/icons/'),
109-
svgBuilder('./src/plugin/'),
112+
svgBuilder(['./src/plugin/','./src/assets/icons/'],base, outDir,'assets', NODE_ENV),
110113
[Banner(`\n Build based on gin-vue-admin \n Time : ${timestamp}`)],
111114
VueFilePathPlugin('./src/pathInfo.json')
112115
]

0 commit comments

Comments
 (0)