fix: 1.取消歌单懒加载 2.修改vite打包时chunk文件命名规则

This commit is contained in:
539943419 committed 2024-09-29 11:00:35 +08:00
1 parent 53ab0ad45b
commit 9611e9f4ed
2 files changed
+72 -68

No files matched your search

+67 -64
View File
@@ -5,69 +5,72 @@ import { resolve } from "path";
// https://vitejs.dev/config/
export default defineConfig({
base: "./",
plugins: [
vue()
// viteSingleFile()
],
resolve: {
alias: {
"@": resolve(__dirname, "src")
}
},
server: {
proxy: {
"/get": {
target: "http://127.0.0.1:17705",
changeOrigin: true,
rewrite: path => path.replace(/^\/get/, "/get")
},
base: './',
plugins: [
vue()
// viteSingleFile()
],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
server: {
proxy: {
'/get': {
target: 'http://127.0.0.1:17705',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/get/, '/get')
},
"/upload": {
target: "http://127.0.0.1:17705",
changeOrigin: true,
rewrite: path => path.replace(/^\/upload/, "/upload")
},
'/upload': {
target: 'http://127.0.0.1:17705',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/upload/, '/upload')
},
"/delete": {
target: "http://127.0.0.1:17705",
changeOrigin: true,
rewrite: path => path.replace(/^\/delete/, "/delete")
},
"/query": {
target: "http://127.0.0.1:17705",
changeOrigin: true,
rewrite: path => path.replace(/^\/query/, "/query")
},
"/rename": {
target: "http://127.0.0.1:17705",
changeOrigin: true,
rewrite: path => path.replace(/^\/rename/, "/rename")
},
"/cut": {
target: "http://127.0.0.1:17705",
changeOrigin: true,
rewrite: path => path.replace(/^\/cut/, "/cut")
},
"/mkdir": {
target: "http://127.0.0.1:17705",
changeOrigin: true,
rewrite: path => path.replace(/^\/mkdir/, "/mkdir")
}
}
},
build: {
rollupOptions: {
input: {
main: "index.html"
},
output: {
manualChunks(id) {
if (id.includes("export.ts") && id.includes('plugins')) {
return "pluginExports";
}
}
}
}
}
});
'/delete': {
target: 'http://127.0.0.1:17705',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/delete/, '/delete')
},
'/query': {
target: 'http://127.0.0.1:17705',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/query/, '/query')
},
'/rename': {
target: 'http://127.0.0.1:17705',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/rename/, '/rename')
},
'/cut': {
target: 'http://127.0.0.1:17705',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/cut/, '/cut')
},
'/mkdir': {
target: 'http://127.0.0.1:17705',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/mkdir/, '/mkdir')
}
}
},
build: {
rollupOptions: {
input: {
main: 'index.html'
},
output: {
entryFileNames: 'assets/[name]-[hash].js',
chunkFileNames: 'assets/chunk-[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash][extname]',
manualChunks(id) {
if (id.includes('export.ts') && id.includes('plugins')) {
return 'pluginExports'
}
}
}
}
}
})