Skip to content

Commit

Permalink
fix: further split up init data to keep all scripts below 4MB
Browse files Browse the repository at this point in the history
  • Loading branch information
alecdwm committed Nov 22, 2023
1 parent 7fc8430 commit c8a86a7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 7 additions & 1 deletion apps/extension/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
}
],
"background": {
"scripts": ["vendor-background-init-data.js", "vendor-background.js", "background.js"],
"scripts": [
"vendor-background-init-chains.js",
"vendor-background-init-tokens.js",
"vendor-background-init-metadata.js",
"vendor-background.js",
"background.js"
],
"persistent": true
},
"web_accessible_resources": ["page.js", "dashboard.js.map"],
Expand Down
12 changes: 8 additions & 4 deletions apps/extension/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ const config = (env) => ({
// We can't automatically chunk these because we need to manually specify the imports in our extension manifest
"vendor-background": {
import: ["@metamask/eth-sig-util", "@substrate/txwrapper-core"],
dependOn: "vendor-background-init-data",
dependOn: [
"vendor-background-init-chains",
"vendor-background-init-tokens",
"vendor-background-init-metadata",
],
},
"vendor-background-init-data": [
"vendor-background-init-chains": [
"@talismn/chaindata-provider-extension/init/chains",
"@talismn/chaindata-provider-extension/init/evm-networks",
"@talismn/chaindata-provider-extension/init/mini-metadatas",
"@talismn/chaindata-provider-extension/init/tokens",
],
"vendor-background-init-tokens": "@talismn/chaindata-provider-extension/init/tokens",
"vendor-background-init-metadata": "@talismn/chaindata-provider-extension/init/mini-metadatas",

// Wallet injected scripts
"content_script": path.join(coreDir, "content_script.ts"),
Expand Down
4 changes: 3 additions & 1 deletion apps/extension/webpack/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ const config = (env) => {
![
"background",
"vendor-background",
"vendor-background-init-data",
"vendor-background-init-chains",
"vendor-background-init-tokens",
"vendor-background-init-metadata",
"content_script",
"page",
].includes(chunk.name),
Expand Down

0 comments on commit c8a86a7

Please sign in to comment.