Skip to content

Commit 5bcd226

Browse files
authored
fix: don't clean root directory if set as outDir (#343)
1 parent a7acd7e commit 5bcd226

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"rollup": "^4.6.1",
5252
"rollup-plugin-dts": "^6.1.0",
5353
"scule": "^1.1.1",
54+
"ufo": "^1.3.2",
5455
"untyped": "^1.4.0"
5556
},
5657
"devDependencies": {

pnpm-lock.yaml

+7-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/build.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Module from "node:module";
22
import { promises as fsp } from "node:fs";
33
import { resolve, relative, isAbsolute, normalize } from "pathe";
4+
import { withTrailingSlash } from "ufo";
45
import type { PackageJson } from "pkg-types";
56
import chalk from "chalk";
67
import { consola } from "consola";
@@ -216,7 +217,11 @@ async function _build(
216217
.filter(Boolean)
217218
.sort() as unknown as Set<string>,
218219
)) {
219-
if (cleanedDirs.some((c) => dir.startsWith(c))) {
220+
if (
221+
dir === options.rootDir ||
222+
options.rootDir.startsWith(withTrailingSlash(dir)) ||
223+
cleanedDirs.some((c) => dir.startsWith(c))
224+
) {
220225
continue;
221226
}
222227
cleanedDirs.push(dir);

0 commit comments

Comments
 (0)