Skip to content

Commit bc87d72

Browse files
committed
fix: 打包时未过滤第三方库
1 parent d6c1f2a commit bc87d72

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib/rebuild-dist.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import * as tsup from 'tsup';
44

55
export const rebuildDist = async (distDir: string, content: string) => {
66
const src = path.normalize(path.join(distDir, '..', 'src'));
7+
const packageJson = await fs.readFile(path.join(distDir, '..', 'package.json'), 'utf8');
8+
const deps = Object.keys(JSON.parse(packageJson).dependencies);
79

810
await fs.writeFile(path.join(src, 'openapi-runtime.ts'), content);
911
await tsup.build({
@@ -19,5 +21,6 @@ export const rebuildDist = async (distDir: string, content: string) => {
1921
dts: true,
2022
legacyOutput: true,
2123
silent: true,
24+
external: deps,
2225
});
2326
};

0 commit comments

Comments
 (0)