perf for size
This commit is contained in:
@@ -53,13 +53,14 @@ export default defineConfig({
|
||||
},
|
||||
base: isDev ? '/' : '/root/center/',
|
||||
build: {
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// 控制输出
|
||||
// 在rollup里面, hash代表将你的文件名和文件内容进行组合计算得来的结果
|
||||
assetFileNames: (chunkInfo) => {
|
||||
console.log(chunkInfo.names);
|
||||
if (chunkInfo.names?.includes('panda.png')) {
|
||||
if (chunkInfo.names?.includes('panda.jpg')) {
|
||||
return '[name].[ext]';
|
||||
}
|
||||
const qrcode = ['qrcode-8x8.jpg'];
|
||||
@@ -69,6 +70,20 @@ export default defineConfig({
|
||||
}
|
||||
return '[name].[hash].[ext]';
|
||||
},
|
||||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) {
|
||||
if (id.includes('react')) {
|
||||
return 'vendor-react';
|
||||
}
|
||||
// prettier
|
||||
if (id.includes('prettier')) {
|
||||
return 'vendor-prettier';
|
||||
}
|
||||
// codemirror
|
||||
// console.log(id);
|
||||
return 'vendor';
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user