Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
chore: build config
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW committed May 15, 2024
1 parent 2e3bac2 commit 635a1ba
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { unlink } from 'node:fs/promises';
import { resolve } from 'node:path';
import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['./src/index'],
hooks: {
'build:done': async (ctx) => {
const outDir = ctx.options.outDir;
const emptyBuildEntries = ctx.buildEntries.filter(
(entry) => entry.exports?.length === 0,
);
await Promise.all(
emptyBuildEntries.map((entry) => {
return unlink(resolve(outDir, entry.path));
}),
);
},
},
rollup: {
emitCJS: true,
inlineDependencies: true,
},
});

0 comments on commit 635a1ba

Please sign in to comment.