mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
build(data-source): umd构建版本将lodash打包进去
This commit is contained in:
parent
a4fc95775e
commit
3f06ca3623
@ -18,7 +18,7 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "npm run build:type && vite build",
|
||||
"build": "npm run build:type && vite build --mode=es && vite build --mode=umd",
|
||||
"build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
||||
"clear:type": "rimraf ./types"
|
||||
},
|
||||
|
@ -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));
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user