2022-12-16 12:03:40 +08:00
|
|
|
import path from 'path'
|
2022-07-06 14:13:27 +08:00
|
|
|
export const OUTPUT_DIR = 'dist'
|
|
|
|
|
|
|
|
// monaco-editor 路径
|
|
|
|
export const prefix = `monaco-editor/esm/vs`
|
2022-03-01 16:46:48 +08:00
|
|
|
|
|
|
|
// chunk 警告大小
|
|
|
|
export const chunkSizeWarningLimit = 2000
|
|
|
|
|
2022-12-16 12:11:16 +08:00
|
|
|
// 禁用 brotliSize 压缩大小报告
|
2022-03-01 16:46:48 +08:00
|
|
|
export const brotliSize = false
|
|
|
|
|
|
|
|
// 分包
|
|
|
|
export const rollupOptions = {
|
|
|
|
output: {
|
|
|
|
chunkFileNames: 'static/js/[name]-[hash].js',
|
|
|
|
entryFileNames: 'static/js/[name]-[hash].js',
|
2022-12-16 12:03:40 +08:00
|
|
|
assetFileNames: (chunkInfo) => {
|
|
|
|
if(['.png', '.jpg', '.jpeg'].includes(path.extname(chunkInfo.name))) {
|
|
|
|
return `static/[ext]/[name].[ext]`
|
|
|
|
}
|
|
|
|
return `static/[ext]/[name]-[hash].[ext]`
|
|
|
|
},
|
2022-07-06 14:13:27 +08:00
|
|
|
manualChunks: {
|
|
|
|
jsonWorker: [`${prefix}/language/json/json.worker`],
|
|
|
|
cssWorker: [`${prefix}/language/css/css.worker`],
|
|
|
|
htmlWorker: [`${prefix}/language/html/html.worker`],
|
|
|
|
tsWorker: [`${prefix}/language/typescript/ts.worker`],
|
|
|
|
editorWorker: [`${prefix}/editor/editor.worker`]
|
|
|
|
}
|
2022-03-01 16:46:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 去除开发代码
|
|
|
|
export const terserOptions = {
|
|
|
|
compress: {
|
|
|
|
keep_infinity: true,
|
|
|
|
drop_console: true,
|
|
|
|
drop_debugger: true
|
|
|
|
}
|
2022-07-06 14:13:27 +08:00
|
|
|
}
|