1
0
mirror of synced 2026-02-04 18:47:57 +08:00

build(data-source): umd构建版本将lodash打包进去

This commit is contained in:
roymondchen
2024-03-25 19:14:41 +08:00
parent a4fc95775e
commit 3f06ca3623
2 changed files with 6 additions and 3 deletions

View File

@@ -22,7 +22,7 @@ import { defineConfig } from 'vite';
import pkg from './package.json';
export default defineConfig({
export default defineConfig(({ mode }) => ({
resolve: {
alias:
process.env.NODE_ENV === 'production'
@@ -48,8 +48,11 @@ export default defineConfig({
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external(id: string) {
if (mode === 'umd' && id === 'lodash-es') {
return false;
}
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id));
},
},
},
});
}));