Bundle third-party.js in ESM (#13509)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-09-23 19:24:54 +08:00
1 parent 16c9d8bafe
commit 5465517f4b
3 files changed
+4 -3

No files matched your search

+1 -1
View File
@@ -218,7 +218,7 @@ function* getEsbuildOptions(bundle, buildOptions) {
esbuildOptions.platform = "node";
esbuildOptions.external.push(...bundledFiles.map(({ output }) => output));
if (interopDefault) {
if (bundle.format !== "esm" && interopDefault) {
esbuildOptions.plugins.push(esbuildPluginInteropDefault());
}
+2 -1
View File
@@ -279,11 +279,12 @@ const coreBundles = [
output: "cli.mjs",
format: "esm",
external: ["benchmark"],
interopDefault: false,
replaceModule: [replaceDiffPackageEntry("lib/patch/create.js")],
},
{
input: "src/common/third-party.js",
output: "third-party.mjs",
format: "esm",
replaceModule: [
// cosmiconfig@6 -> import-fresh can't find parentModule, since module is bundled
{
+1 -1
View File
@@ -12,7 +12,7 @@ const prettierCli = path.join(
);
const thirdParty = isProduction
? path.join(PRETTIER_DIR, "./third-party.js")
? path.join(PRETTIER_DIR, "./third-party.mjs")
: path.join(PRETTIER_DIR, "./src/common/third-party.js");
const projectRoot = path.join(__dirname, "../..");