Skip to content

Commit bc32e4e

Browse files
committed
perf: 优化文档保存方案
1 parent 85fae18 commit bc32e4e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/lib/rebuild-dist.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ export const rebuildDist = async (
1212

1313
{
1414
let backupDTS = await readFile(path.join(backupDir, 'index.d.ts'), 'utf8');
15-
backupDTS = backupDTS.replace(
16-
`export {`,
17-
`${dtsContent}\nexport {${classNames.join(',')},`,
18-
);
15+
backupDTS += `\n${dtsContent}\nexport { ${classNames.join(', ')} };`;
1916
await writeFile(path.join(distDir, 'index.d.ts'), backupDTS);
2017
}
2118

@@ -34,10 +31,7 @@ export const rebuildDist = async (
3431

3532
{
3633
let backupESM = await readFile(path.join(backupDir, 'esm', 'index.js'), 'utf8');
37-
backupESM = backupESM.replace(
38-
'export {',
39-
`${jsContent}\nexport {\n${classNames.join(',')},`,
40-
);
34+
backupESM += `\n${jsContent}\nexport { ${classNames.join(', ')} };`;
4135
await writeFile(path.join(distDir, 'esm', 'index.js'), backupESM);
4236
}
4337
};

0 commit comments

Comments
 (0)