From ab31fa7f0cde0ce9d0333604b9a852ef84c4967e Mon Sep 17 00:00:00 2001 From: 1aron Date: Thu, 10 Aug 2023 12:02:10 +0800 Subject: [PATCH] Fix(Pack): Cannot use "external" without "bundle" --- .github/workflows/sync-dev-branches.yml | 2 +- packages/pack/src/actions/main.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-dev-branches.yml b/.github/workflows/sync-dev-branches.yml index 2ff0da6..19eb14c 100644 --- a/.github/workflows/sync-dev-branches.yml +++ b/.github/workflows/sync-dev-branches.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Sync dev branches - uses: 1aron/techor@v2.4.6 + uses: 1aron/techor@v2.5.6 with: action: "sync-dev-branches" env: diff --git a/packages/pack/src/actions/main.ts b/packages/pack/src/actions/main.ts index 3c76128..b10055b 100644 --- a/packages/pack/src/actions/main.ts +++ b/packages/pack/src/actions/main.ts @@ -98,7 +98,7 @@ module.exports = async function action(specifiedEntries: string[], options: any } const eachOutdir = eachOptions.outdir || options.outdir - /** + /** * Keep original directory output and prevent bundling * @example $ esbuild entry.js a.js b.js external.j --format=esm --outdir=dist --bundle --external:./a --external:./b * @example https://esbuild.github.io/try/#YgAwLjE4LjExAGVudHJ5LmpzIGEuanMgYi5qcyBleHRlcm5hbC5qIC0tZm9ybWF0PWVzbSAtLW91dGRpcj1kaXN0IC0tYnVuZGxlIC0tZXh0ZXJuYWw6Li9hIC0tZXh0ZXJuYWw6Li9iAABlbnRyeS5qcwBleHBvcnQgKiBmcm9tICcuL2EnCmV4cG9ydCAqIGZyb20gJy4vYicKZXhwb3J0ICogZnJvbSAnLi9leHRlcm5hbCcAAGEuanMAZXhwb3J0IGNvbnN0IGEgPSAnYScAAGIuanMAZXhwb3J0IGNvbnN0IGIgPSAnYicAAGV4dGVybmFsLmpzAGV4cG9ydCBjb25zdCBleHRlcm5hbCA9ICdleHRlcm5hbCc @@ -133,6 +133,11 @@ module.exports = async function action(specifiedEntries: string[], options: any delete buildOptions.target } + // Fixed: Cannot use "external" option with "bundle" option + if (!buildOptions.bundle) { + delete buildOptions.external + } + // if (!eachOptions.bundle && eachOptions.format === 'esm') { // buildOptions.plugins.push(createFillModuleExtPlugin(options.esmExt)) // }