diff --git a/scripts/build/command.mjs b/scripts/build/command.mjs index 1dfcf610fd..e68b51bb45 100644 --- a/scripts/build/command.mjs +++ b/scripts/build/command.mjs @@ -24,6 +24,8 @@ 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 { @@ -31,6 +33,7 @@ async function run() { inputs, external, 'external-all-except': externalAllExcept, + splitting, } = commandLineArgs(optionDefinitions); if (!path) { @@ -84,6 +87,7 @@ async function run() { const esbuildTask = esbuild.build({ bundle: true, minify: true, + splitting: !!splitting, keepNames: true, sourcemap: true, platform: 'browser', diff --git a/wallets/provider-coin98/package.json b/wallets/provider-coin98/package.json index 8931203bd1..7e785b8611 100644 --- a/wallets/provider-coin98/package.json +++ b/wallets/provider-coin98/package.json @@ -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}'", @@ -31,4 +31,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-ledger/package.json b/wallets/provider-ledger/package.json index d28ebe59e9..dc58dd7526 100644 --- a/wallets/provider-ledger/package.json +++ b/wallets/provider-ledger/package.json @@ -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}'", @@ -38,4 +38,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-math-wallet/package.json b/wallets/provider-math-wallet/package.json index 71177e2560..c2b630feb6 100644 --- a/wallets/provider-math-wallet/package.json +++ b/wallets/provider-math-wallet/package.json @@ -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}'", @@ -30,4 +30,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-safe/package.json b/wallets/provider-safe/package.json index 0c61a6692e..e61eeebc11 100644 --- a/wallets/provider-safe/package.json +++ b/wallets/provider-safe/package.json @@ -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}'", @@ -31,4 +31,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-solflare-snap/package.json b/wallets/provider-solflare-snap/package.json index 5a6ce8e10a..3912ebc1a9 100644 --- a/wallets/provider-solflare-snap/package.json +++ b/wallets/provider-solflare-snap/package.json @@ -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}'", @@ -31,4 +31,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-solflare/package.json b/wallets/provider-solflare/package.json index 1d62f159d3..9855b4b484 100644 --- a/wallets/provider-solflare/package.json +++ b/wallets/provider-solflare/package.json @@ -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}'", @@ -30,4 +30,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-trezor/package.json b/wallets/provider-trezor/package.json index 3993c3a9e9..90475b54e2 100644 --- a/wallets/provider-trezor/package.json +++ b/wallets/provider-trezor/package.json @@ -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}'", @@ -33,4 +33,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-walletconnect-2/package.json b/wallets/provider-walletconnect-2/package.json index e7778c5a45..9fdd629e50 100644 --- a/wallets/provider-walletconnect-2/package.json +++ b/wallets/provider-walletconnect-2/package.json @@ -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}'", @@ -45,4 +45,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-xdefi/package.json b/wallets/provider-xdefi/package.json index 7bfb3f92fc..ce8585b830 100644 --- a/wallets/provider-xdefi/package.json +++ b/wallets/provider-xdefi/package.json @@ -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}'", @@ -31,4 +31,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +}