fix: build clean (#3351)
This commit is contained in:
parent
effff269dc
commit
849096aafa
@ -127,14 +127,22 @@ const pluginPrefix = (
|
|||||||
|
|
||||||
const target_dir = 'dist';
|
const target_dir = 'dist';
|
||||||
|
|
||||||
export function deleteJsFiles(cwd: string, log: PkgLog) {
|
export function deleteServerFiles(cwd: string, log: PkgLog) {
|
||||||
log('delete babel js files');
|
log('delete server files');
|
||||||
const jsFiles = fg.globSync(['**/*', '!**/*.d.ts', '!node_modules'], {
|
const files = fg.globSync(['*'], {
|
||||||
cwd: path.join(cwd, target_dir),
|
cwd: path.join(cwd, target_dir),
|
||||||
absolute: true,
|
absolute: true,
|
||||||
|
deep: 1,
|
||||||
|
onlyFiles: true,
|
||||||
});
|
});
|
||||||
jsFiles.forEach((item) => {
|
const dirs = fg.globSync(['*', '!client', '!node_modules'], {
|
||||||
fs.unlinkSync(item);
|
cwd: path.join(cwd, target_dir),
|
||||||
|
absolute: true,
|
||||||
|
deep: 1,
|
||||||
|
onlyDirectories: true,
|
||||||
|
});
|
||||||
|
[...files, ...dirs].forEach((item) => {
|
||||||
|
fs.removeSync(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,6 +263,8 @@ export async function buildPluginServer(cwd: string, userConfig: UserConfig, sou
|
|||||||
log('%s will not be processed, only be copied to the dist directory.', chalk.yellow(otherExts.join(',')));
|
log('%s will not be processed, only be copied to the dist directory.', chalk.yellow(otherExts.join(',')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteServerFiles(cwd, log);
|
||||||
|
|
||||||
await tsupBuild(userConfig.modifyTsupConfig({
|
await tsupBuild(userConfig.modifyTsupConfig({
|
||||||
entry: serverFiles,
|
entry: serverFiles,
|
||||||
splitting: false,
|
splitting: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user