66 alias ,
77 wrapperEnv ,
88 pathResolve ,
9- __APP_INFO__
9+ __APP_INFO__ ,
1010} from "./build/utils" ;
1111
1212export default ( { mode } : ConfigEnv ) : UserConfigExport => {
@@ -16,31 +16,31 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
1616 base : VITE_PUBLIC_PATH ,
1717 root,
1818 resolve : {
19- alias
19+ alias,
2020 } ,
2121 // 服务端渲染
2222 server : {
2323 // 端口号
2424 port : VITE_PORT ,
2525 host : "0.0.0.0" ,
2626 // 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
27- proxy : {
28- "/slbma" : {
29- target : "https://slwl-api.itheima.net" , //本地调试时使用
30- changeOrigin : true ,
31- rewrite : ( path ) => path . replace ( / ^ \/ s l b m a / , '' ) ,
27+ proxy : {
28+ "/slbma" : {
29+ target : "http://localhost:8989" , //本地调试时使用
30+ changeOrigin : true ,
31+ rewrite : ( path ) => path . replace ( / ^ \/ s l b m a / , "" ) ,
32+ } ,
3233 } ,
33- } ,
3434 // 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
3535 warmup : {
36- clientFiles : [ "./index.html" , "./src/{views,components}/*" ]
37- }
36+ clientFiles : [ "./index.html" , "./src/{views,components}/*" ] ,
37+ } ,
3838 } ,
3939 plugins : getPluginsList ( VITE_CDN , VITE_COMPRESSION ) ,
4040 // https://cn.vitejs.dev/config/dep-optimization-options.html#dep-optimization-options
4141 optimizeDeps : {
4242 include,
43- exclude
43+ exclude,
4444 } ,
4545 build : {
4646 // https://cn.vitejs.dev/guide/build.html#browser-compatibility
@@ -50,19 +50,19 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
5050 chunkSizeWarningLimit : 4000 ,
5151 rollupOptions : {
5252 input : {
53- index : pathResolve ( "./index.html" , import . meta. url )
53+ index : pathResolve ( "./index.html" , import . meta. url ) ,
5454 } ,
5555 // 静态资源分类打包
5656 output : {
5757 chunkFileNames : "static/js/[name]-[hash].js" ,
5858 entryFileNames : "static/js/[name]-[hash].js" ,
59- assetFileNames : "static/[ext]/[name]-[hash].[ext]"
60- }
61- }
59+ assetFileNames : "static/[ext]/[name]-[hash].[ext]" ,
60+ } ,
61+ } ,
6262 } ,
6363 define : {
6464 __INTLIFY_PROD_DEVTOOLS__ : false ,
65- __APP_INFO__ : JSON . stringify ( __APP_INFO__ )
66- }
65+ __APP_INFO__ : JSON . stringify ( __APP_INFO__ ) ,
66+ } ,
6767 } ;
6868} ;
0 commit comments