Skip to content

Commit

Permalink
Modify build process to disable code splitting
Browse files Browse the repository at this point in the history
The code splitting feature in `tsup` breaks up source code into logical
modules so that if a module is not being used it can be removed by a
build tool that supports tree shaking.

However, the modules that `tsup` creates do not necessary match the
files in the original source code, and `tsup` gives them a random name.
This makes it frustrating for developers on a client team who are
debugging a `core` package by inspecting the compiled version, because
it is impossible to tell what a chunk file contains without first
opening it up.

The ultimate solution would be to write `core` packages in ESM natively.
This would obviate the need to transpile these packages at all, at least
to ESM; they would only need to be transpiled to CommonJS. Then we could
only use code splitting for CJS, but we would not need to use code
splitting for ESM, because it would already be the form that would make
tree shaking possible.

In the meantime, however, it is more important to ensure that we don't
make client developers' lives worse than make our code tree-shakable.
This commit thus configures `tsup` to disable the code splitting
feature.
  • Loading branch information
mcmire committed May 28, 2024
1 parent 6541697 commit 0bf7589
Show file tree
Hide file tree
Showing 35 changed files with 67 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@types/readable-stream": "^2.3.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/address-book-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/announcement-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/approval-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"jest": "^27.5.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/base-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"jest": "^27.5.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/build-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"eslint": "^8.44.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/chain-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/composable-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"jest": "^27.5.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/controller-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"jest": "^27.5.1",
"nock": "^13.3.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/ens-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/eth-json-rpc-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"jest": "^27.5.1",
"jest-it-up": "^2.0.2",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typescript": "~4.9.5"
},
Expand Down
1 change: 1 addition & 0 deletions packages/gas-fee-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"jest-when": "^3.4.2",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/json-rpc-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"jest": "^27.5.1",
"jest-it-up": "^2.0.2",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typescript": "~4.9.5"
},
Expand Down
1 change: 1 addition & 0 deletions packages/json-rpc-middleware-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"jest": "^27.5.1",
"jest-it-up": "^2.0.2",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5",
Expand Down
1 change: 1 addition & 0 deletions packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"jest-environment-node": "^27.5.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5",
Expand Down
1 change: 1 addition & 0 deletions packages/logging-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/message-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/name-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/network-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/notification-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/permission-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/permission-log-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"jest": "^27.5.1",
"nanoid": "^3.1.31",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/phishing-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/polling-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"jest": "^27.5.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/preferences-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"jest": "^27.5.1",
"lodash": "^4.17.21",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/profile-sync-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"jest-environment-jsdom": "^27.5.1",
"nock": "^13.3.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/queued-request-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/rate-limit-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/selected-network-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/signature-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/transaction-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
1 change: 1 addition & 0 deletions packages/user-operation-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~4.9.5"
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const config: Options = {

// Split the output into chunks. This is useful for tree-shaking.
// https://tsup.egoist.dev/#code-splitting
splitting: true,
splitting: false,
};

export default config;
Loading

0 comments on commit 0bf7589

Please sign in to comment.