Skip to content

Commit

Permalink
perf: enable code splitting in build process
Browse files Browse the repository at this point in the history
  • Loading branch information
RyukTheCoder committed Oct 7, 2024
1 parent 73042bf commit 10dae02
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 18 deletions.
4 changes: 4 additions & 0 deletions scripts/build/command.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ async function run() {
// When you want to make all the packages external, and only include some specific packages as your library bundle, this will be usefull.
// Comma separated.
{ name: 'external-all-except', type: String },
// Enable code splitting
{ name: 'splitting', type: Boolean },
];

const {
path,
inputs,
external,
'external-all-except': externalAllExcept,
splitting,
} = commandLineArgs(optionDefinitions);

if (!path) {
Expand Down Expand Up @@ -84,6 +87,7 @@ async function run() {
const esbuildTask = esbuild.build({
bundle: true,
minify: true,
splitting: !!splitting,
keepNames: true,
sourcemap: true,
platform: 'browser',
Expand Down
4 changes: 2 additions & 2 deletions wallets/provider-coin98/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-coin98",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-coin98 --splitting",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -31,4 +31,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-ledger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-ledger --external-all-except @ledgerhq/errors,@ledgerhq/hw-app-eth,@ledgerhq/hw-app-solana,@ledgerhq/hw-transport-webhid,@ledgerhq/types-cryptoassets,@ledgerhq/types-devices,",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-ledger --splitting --external-all-except @ledgerhq/errors,@ledgerhq/hw-app-eth,@ledgerhq/hw-app-solana,@ledgerhq/hw-transport-webhid,@ledgerhq/types-cryptoassets,@ledgerhq/types-devices,",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -38,4 +38,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-math-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-math-wallet",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-math-wallet --splitting",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -30,4 +30,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-safe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-safe",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-safe --splitting",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -31,4 +31,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-solflare-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-solflare-snap",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-solflare-snap --splitting",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -31,4 +31,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-solflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-solflare",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-solflare --splitting",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -30,4 +30,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-trezor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-trezor",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-trezor --splitting",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -33,4 +33,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-walletconnect-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-walletconnect-2 --external-all-except @walletconnect/modal",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-walletconnect-2 --splitting --external-all-except @walletconnect/modal",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand Down Expand Up @@ -45,4 +45,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions wallets/provider-xdefi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src"
],
"scripts": {
"build": "node ../../scripts/build/command.mjs --path wallets/provider-xdefi",
"build": "node ../../scripts/build/command.mjs --path wallets/provider-xdefi --splitting",
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
"clean": "rimraf dist",
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
Expand All @@ -30,4 +30,4 @@
"publishConfig": {
"access": "public"
}
}
}

0 comments on commit 10dae02

Please sign in to comment.