Skip to content

Commit

Permalink
perf(module-tools): skip build js and d.ts when input is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
10Derozan committed Jan 15, 2024
1 parent f6b0e59 commit a6cefd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/breezy-eyes-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/module-tools': patch
---

perf(module-tools): skip build js and d.ts when input is empty
perf(module-tools): 当没有入口时跳过构建 js 和 d.ts 文件
5 changes: 5 additions & 0 deletions packages/solutions/module-tools/src/builder/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export const runBuildTask = async (
const { watch } = buildCmdOptions;
const existTsconfig = await fs.pathExists(buildConfig.tsconfig);

if (Object.keys(buildConfig.input).length === 0) {
logger.info('If input is empty, js and dts task will be skipped');
return;
}

if (dts && existTsconfig) {
const tasks = dts.only ? [generatorDts] : [buildLib, generatorDts];
await pMap(tasks, async task => {
Expand Down

0 comments on commit a6cefd4

Please sign in to comment.