mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-04-22 04:27:58 +00:00
Fix: prevent double ./cjs/ prefix in main field
When package.json already has main: './cjs/index.js', the build script was incorrectly adding another ./cjs/ prefix resulting in './cjs/cjs/index.js' Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -792,7 +792,8 @@ function buildExports () {
|
|||||||
? pkg.main
|
? pkg.main
|
||||||
: `./${pkg.main}`;
|
: `./${pkg.main}`;
|
||||||
|
|
||||||
pkg.main = main.replace(/^\.\//, './cjs/');
|
// Only add ./cjs/ prefix if main doesn't already start with ./cjs/
|
||||||
|
pkg.main = main.startsWith('./cjs/') ? main : main.replace(/^\.\//, './cjs/');
|
||||||
pkg.module = main;
|
pkg.module = main;
|
||||||
pkg.types = main.replace('.js', '.d.ts');
|
pkg.types = main.replace('.js', '.d.ts');
|
||||||
}
|
}
|
||||||
@@ -806,7 +807,8 @@ function buildExports () {
|
|||||||
? value
|
? value
|
||||||
: `./${value}`;
|
: `./${value}`;
|
||||||
|
|
||||||
pkg[k] = entry.replace(/^\.\//, './cjs/');
|
// Only add ./cjs/ prefix if entry doesn't already start with ./cjs/
|
||||||
|
pkg[k] = entry.startsWith('./cjs/') ? entry : entry.replace(/^\.\//, './cjs/');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user