From a6b08b0bd1099aef4e3c32bf5cde5b8106c91108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 16 Dec 2022 04:03:40 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8B=89=E5=8F=96=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=A4=84=E7=90=86=E7=9A=84PR=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/constant.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build/constant.ts b/build/constant.ts index 38ff0454..9d6ca339 100644 --- a/build/constant.ts +++ b/build/constant.ts @@ -1,3 +1,4 @@ +import path from 'path' export const OUTPUT_DIR = 'dist' // monaco-editor 路径 @@ -6,7 +7,7 @@ export const prefix = `monaco-editor/esm/vs` // chunk 警告大小 export const chunkSizeWarningLimit = 2000 -// 禁用 brotli 压缩大小报告 +// 禁用 brotli 压缩大小报告A export const brotliSize = false // 分包 @@ -14,7 +15,12 @@ export const rollupOptions = { output: { chunkFileNames: 'static/js/[name]-[hash].js', entryFileNames: 'static/js/[name]-[hash].js', - assetFileNames: 'static/[ext]/[name]-[hash].[ext]', + assetFileNames: (chunkInfo) => { + if(['.png', '.jpg', '.jpeg'].includes(path.extname(chunkInfo.name))) { + return `static/[ext]/[name].[ext]` + } + return `static/[ext]/[name]-[hash].[ext]` + }, manualChunks: { jsonWorker: [`${prefix}/language/json/json.worker`], cssWorker: [`${prefix}/language/css/css.worker`],