Skip to content

Commit

Permalink
fix(core): should external package.json from bundle (web-infra-dev#8140)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Oct 16, 2024
1 parent 1382bac commit 490eb8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/rspack/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Options, defineConfig } from "tsup";
import prebundleConfig from "./prebundle.config.mjs";

const aliasCompiledPlugin = {
const aliasPlugin = {
name: "alias-compiled-plugin",
setup(build) {
const { dependencies } = prebundleConfig;
Expand All @@ -13,13 +13,18 @@ const aliasCompiledPlugin = {
external: true
}));
}

build.onResolve({ filter: /..\/package\.json/ }, () => ({
path: "../package.json",
external: true
}));
}
};

const commonConfig: Options = {
format: ["cjs"],
target: "node16",
esbuildPlugins: [aliasCompiledPlugin]
esbuildPlugins: [aliasPlugin]
};

export default defineConfig([
Expand Down

0 comments on commit 490eb8c

Please sign in to comment.