We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing and importing external libraries unreasonably increases build times and bundle size. Tree shaking is not taking effect.
Environment: WSL2 Plasmo version: 0.87.1 Node: v20.12.2
Steps to reproduce:
pnpm create plasmo
pnpm build
pnpm install @tabler/icons-react
rm -rf .plasmo build
popup.tsx
import { IconPlus } from "@tabler/icons-react" export default function IndexPopup() { return <IconPlus /> }
24-fold increase in build time and the entire library was included in the final build❗
Looking at popup.js build file it's clear that all the icons in the library have made it to the build only single one was used.
popup.js
By the looks of it seems that parcel config is not correct causing the build times and bundle sizes to balloon.
Did the same experiment with lodash-es. Only 1 function is being used in popup.tsx but all lodash functions are making into the build file.
lodash-es
Here what is being added to build popop.js file.
popop.js
*/ var t = e("@parcel/transformer-js/src/esmodule-helpers.js") t.defineInteropFlag(n), t.export(n, "Icon123", () => i.default), t.export(n, "IconNumber123", () => i.default), t.export(n, "Icon360", () => l.default), t.export(n, "IconView360Arrow", () => l.default), t.export(n, "IconCodeAsterisk", () => p.default), ... Total extra 5391 lines of code
var r = e("./icons/index.mjs"), c = e("./icons-list.mjs"), s = e("./icons/IconNumber123.mjs"), i = t.interopDefault(s), a = e("./icons/IconView360Arrow.mjs"), l = t.interopDefault(a), u = e("./icons/IconCodeAsterisk.mjs"), ... Total extra 10 582 lines of code
"./icons/index.mjs": !1, "./icons-list.mjs": !1, "./icons/IconNumber123.mjs": !1, "./icons/IconView360Arrow.mjs": !1, "./icons/IconCodeAsterisk.mjs": !1, "./icons/IconRosetteDiscount.mjs": !1, "./icons/IconRosetteDiscountOff.mjs": !1, ... Total extra 5291 lines of code
So final bundle includes additional 21264 lines of code❗
Related to issue #664
Latest
Linux, Other
Microsoft Edge
## Build without the library > plasmo build "--verbose" 🟡 0 | Running command: build 🟣 Plasmo v0.87.1 🔴 The Browser Extension Framework 🔵 INFO | Prepare to bundle the extension... 🟡 1 | Creating Manifest Factory... 🟡 2 | Ensure exists: /home/evaldas/build-perf-example/.plasmo 🟡 3 | /home/evaldas/build-perf-example/assets/icon.png found, creating resized icons 🟡 4 | Creating static templates for popup 🟡 5 | Creating static templates for options 🟡 6 | Creating static templates for newtab 🟡 7 | Creating static templates for devtools 🟡 8 | Creating static templates for sidepanel 🟡 9 | { messageHandlerList: [], externalMessageHandlerList: [], portHandlerList: [] } 🟡 10 | Hash changed, updating manifest 🔵 INFO | Loaded environment variables from: [] 🟡 0 | @plasmohq/parcel-transformer-manifest 🟡 1 | Adding icons 🟡 2 | Adding default_icon 🟡 3 | Adding default_popup 🟡 4 | + Finished transforming manifest 🟡 0 | @plasmohq/parcel-bundler 🟡 0 | @plasmohq/parcel-packager 🟡 0 | @plasmohq/parcel-optimizer-encapsulate popup.100f6462.js popup.[hash].js 🟡 0 | @plasmohq/optimizer-es: popup.100f6462.js popup.[hash].js /home/evaldas/build-perf-example 🟡 1 | optimizer-es: use SWC for popup.[hash].js 🟢 DONE | Finished in 1546ms! ## Build including the library > plasmo build "--verbose" 🟡 0 | Running command: build 🟣 Plasmo v0.87.1 🔴 The Browser Extension Framework 🔵 INFO | Prepare to bundle the extension... 🟡 1 | Creating Manifest Factory... 🟡 2 | Ensure exists: /home/evaldas/build-perf-example/.plasmo 🟡 3 | /home/evaldas/build-perf-example/assets/icon.png found, creating resized icons 🟡 4 | Creating static templates for popup 🟡 5 | Creating static templates for options 🟡 6 | Creating static templates for newtab 🟡 7 | Creating static templates for devtools 🟡 8 | Creating static templates for sidepanel 🟡 9 | { messageHandlerList: [], externalMessageHandlerList: [], portHandlerList: [] } 🟡 10 | Hash changed, updating manifest 🔵 INFO | Loaded environment variables from: [] 🟡 0 | @plasmohq/parcel-transformer-manifest 🟡 1 | Adding icons 🟡 2 | Adding default_icon 🟡 3 | Adding default_popup 🟡 4 | + Finished transforming manifest 🟡 0 | @plasmohq/parcel-bundler 🟡 0 | @plasmohq/parcel-packager 🟡 0 | @plasmohq/parcel-optimizer-encapsulate popup.100f6462.js popup.[hash].js 🟡 0 | @plasmohq/optimizer-es: popup.100f6462.js popup.[hash].js /home/evaldas/build-perf-example 🟡 1 | optimizer-es: use SWC for popup.[hash].js 🟢 DONE | Finished in 30099ms!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What happened?
Installing and importing external libraries unreasonably increases build times and bundle size. Tree shaking is not taking effect.
Environment: WSL2
Plasmo version: 0.87.1
Node: v20.12.2
Steps to reproduce:
pnpm create plasmo
pnpm build
for reference point. Build time is 1379ms✔ build size is 153kb✔pnpm install @tabler/icons-react
rm -rf .plasmo build
popup.tsx
file:pnpm build
Build time is 33180ms❌ build size is 899kb❌24-fold increase in build time and the entire library was included in the final build❗
Looking at
popup.js
build file it's clear that all the icons in the library have made it to the build only single one was used.By the looks of it seems that parcel config is not correct causing the build times and bundle sizes to balloon.
Did the same experiment with
lodash-es
. Only 1 function is being used inpopup.tsx
but all lodash functions are making into the build file.Here what is being added to build
popop.js
file.So final bundle includes additional 21264 lines of code❗
Related to issue #664
Version
Latest
What OS are you seeing the problem on?
Linux, Other
What browsers are you seeing the problem on?
Microsoft Edge
Relevant log output
(OPTIONAL) Contribution
Code of Conduct
The text was updated successfully, but these errors were encountered: