Skip to content

Commit

Permalink
chore: optimize package size (#1396)
Browse files Browse the repository at this point in the history
  • Loading branch information
iosh authored Aug 27, 2024
1 parent c8ff802 commit ae5c7d4
Show file tree
Hide file tree
Showing 7 changed files with 360 additions and 523 deletions.
15 changes: 15 additions & 0 deletions .yarn/versions/5c772db8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
releases:
"@fluent-wallet/cfx_send-transaction": patch
"@fluent-wallet/cfx_sign-transaction": patch
"@fluent-wallet/cfx_sign-tx-with-ledger-nano-s": patch
"@fluent-wallet/eth_send-transaction": patch
"@fluent-wallet/eth_sign-transaction": patch
"@fluent-wallet/eth_sign-tx-with-ledger-nano-s": patch
"@fluent-wallet/ledger": patch
"@fluent-wallet/wallet_import-hardware-wallet-account-group-or-account": patch
"@fluent-wallet/wallet_send-transaction": patch
"@fluent-wallet/wallet_send-transaction-with-action": patch
browser-extension: patch
helios: patch
helios-background: patch
helios-popup: patch
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"build:chrome": "cross-env NODE_ENV=production cross-env TARGET_BROWSER=chrome webpack --config ./scripts/webpack.config.prod.mjs",
"build:firefox": "cross-env NODE_ENV=production cross-env TARGET_BROWSER=firefox webpack --config ./scripts/webpack.config.prod.mjs",
"build:edge": "cross-env NODE_ENV=production cross-env TARGET_BROWSER=edge webpack --config ./scripts/webpack.config.prod.mjs",
"build": "yarn build:chrome && yarn build:firefox && yarn build:edge"
"build": "yarn build:chrome && yarn build:firefox && yarn build:edge && yarn removeEmptyFile",
"removeEmptyFile": "rm -rf ./dist/*/manifest.js"
},
"devDependencies": {
"@babel/core": "7.17.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@fluent-wallet/base32-address": "workspace:packages/base32-address",
"@fluent-wallet/hw-app-conflux": "0.0.8",
"@ledgerhq/hw-app-eth": "6.38.0",
"@ledgerhq/hw-app-eth": "6.24.1",
"@ledgerhq/hw-transport-webusb": "6.29.2"
}
}
1 change: 1 addition & 0 deletions scripts/webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const defaultConfig = {
},
alias: {
'/images': path.join(packagesPath, 'browser-extension/images'),
"js-conflux-sdk": path.join(path.resolve(), './node_modules/js-conflux-sdk'),
},
},
plugins: [
Expand Down
5 changes: 5 additions & 0 deletions scripts/webpack.config.dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const devConfig = {
mode: 'development',
devtool: 'inline-cheap-module-source-map',
watch: true,
output: isFirefox
? {
chunkFormat: 'array-push',
}
: undefined,
plugins: [
new Dotenv({
prefix: 'import.meta.env.',
Expand Down
10 changes: 10 additions & 0 deletions scripts/webpack.config.prod.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ const isFirefox = process.env.TARGET_BROWSER === 'firefox'
const prodConfig = {
mode: 'production',
devtool: false,
performance: {
maxEntrypointSize: 2500000,
maxAssetSize: 2500000,
},
output: isFirefox
? {
chunkFormat: 'array-push',
}
: undefined,
plugins: [
new MiniCssExtractPlugin(),
new Dotenv({
Expand All @@ -23,6 +32,7 @@ const prodConfig = {
// new BundleAnalyzerPlugin(),
],
optimization: {
minimize: true,
minimizer: [
new EsbuildPlugin({
target: 'esnext', // Syntax to transpile to (see options below for possible values)
Expand Down
Loading

0 comments on commit ae5c7d4

Please sign in to comment.