Revert "Use ESM entrypoint for require(ESM)" (#17156)
Co-authored-by: Tatsunori Uchino <tats.u@live.jp>
This commit is contained in:
1 parent
c98acabc34
commit
bf5aab8f2d
4 files changed
+12
-5
No files matched your search
@@ -42,7 +42,6 @@ async function buildPackageJson({ file, files }) {
|
||||
exports: {
|
||||
".": {
|
||||
types: "./index.d.ts",
|
||||
"module-sync": "./index.mjs",
|
||||
require: "./index.cjs",
|
||||
browser: {
|
||||
import: "./standalone.mjs",
|
||||
@@ -56,14 +55,14 @@ async function buildPackageJson({ file, files }) {
|
||||
.filter((file) => file.output.format === "umd")
|
||||
.map((file) => {
|
||||
const basename = path.basename(file.output.file, ".js");
|
||||
const mjsPath = `./${file.output.file.replace(/\.js$/u, ".mjs")}`;
|
||||
return [
|
||||
file.isPlugin ? `./plugins/${basename}` : `./${basename}`,
|
||||
{
|
||||
types: `./${file.output.file.replace(/\.js$/u, ".d.ts")}`,
|
||||
"module-sync": mjsPath,
|
||||
// `module-sync` condition can prevent CJS plugins from working: https://github.com/prettier/prettier/issues/17139
|
||||
// Perform a test before re-adding it.
|
||||
require: `./${file.output.file}`,
|
||||
default: mjsPath,
|
||||
default: `./${file.output.file.replace(/\.js$/u, ".mjs")}`,
|
||||
},
|
||||
];
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user