Skip to content

Commit 794ec92

Browse files
hardfistchenjiahan
andauthored
fix(core): calculate pkgJson from configPath dir (#8985)
Co-authored-by: neverland <[email protected]>
1 parent 4f81661 commit 794ec92

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/rspack-cli/src/utils/isEsmFile.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const isEsmFile = (filePath: string, cwd = process.cwd()) => {
1010
if (/\.(cjs|cts)/.test(ext)) {
1111
return false;
1212
}
13-
const packageJson = readPackageUp(cwd);
13+
// package.json should be find from configPath root
14+
const packageJson = readPackageUp(path.dirname(filePath));
1415
return packageJson?.type === "module";
1516
};
1617

0 commit comments

Comments
 (0)