-
Notifications
You must be signed in to change notification settings - Fork 337
Larger size of the generated worker with wrangler v1.9.x #1338
Comments
Hey @jorgelbg - this seems like a bug but it's hard to know what's happening without a repo that can reliably reproduce the error. Could you make an example repository or link the repository you're using so we can attempt to reproduce the different behavior between 1.8 and 1.9? Thanks! |
@EverlastingBugstopper here is the repository where I've seen the issue https://github.com/jorgelbg/loki-log-shipper. BTW Thanks for the template 😄. |
If I run $ wrangler --version
👷 ✨ wrangler 1.8.4 $ wrangler build
> [email protected] install ~/dir/loki-log-shipper/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
npm WARN [email protected] No repository field.
added 614 packages from 905 contributors and audited 615 packages in 18.146s
16 packages are looking for funding
run `npm fund` for details
found 19 vulnerabilities (16 low, 3 moderate)
run `npm audit fix` to fix them, or `npm audit` for details
⬇️ Installing wranglerjs...
⬇️ Installing wasm-pack...
Warning: webpack's output filename is being renamed to worker.js because of requirements from the Workers runtime
✨ Built successfully, built project size is 1 MiB. ⚠️ Your built project has grown past the 1MiB size limit and may fail to deploy. ⚠️ |
that being said - if you remove |
🤔 I've even cloned the repository into a different path and run with 1.8.4 and I don't get the error, I do get it with 1.9.2. Indeed removing the source maps trims down the size, but I was more puzzled about the difference in size between the 2 versions without any other changes. |
Tried again now and this is the console output of the entire clone/build process: https://gist.github.com/jorgelbg/734a401858bdae18275276180bc76741 |
hmmmmmm - i cannot reproduce this for the life of me. perhaps @ashleymichal can take a look? super strange for sure... as for the template, i've updated it to not include source maps: https://github.com/EverlastingBugstopper/worker-typescript-template/compare/972ddb6..aa7435c |
To make things even more strange, after removing the source maps, I still see a difference in the project size between v1.8 and v1.9: v1.8.4:
v1.9.2:
|
One important note, the value derives from webpack. The uncompressed id 885 KiB (compressed 275 KiB). @jorgelbg can you check the uncompressed of the other versions? v1.10.1: |
@adaptive Sizes between v1.9.x and v1.10.x are somehow similar but still larger than v.1.8.4. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. You may re-open the issue if it is still relevant. |
I'm having this exact problem. The same project/code, builds and packages to 206KB with wrangler 1.6, but jumps to 377KB when I upgrade wrangler to 1.11. This is the same on windows and mac. This jump in size is unacceptable for a platform like this. I'll be sticking with old versions of wrangler until this issues is sorted out. |
I think I've found the underlying problem. It's dependency duplication. In the bundled worker.js file, I have the same package (bn.js) included 8 times! It is highly likely that there are other packages duplicated as well. See below references: // "../../../../AppData/Local/.wrangler/wranglerjs-1.11.0/node_modules/asn1.js/node_modules/bn.js/lib/bn.js": |
Just to confirm, this is still an issue with version 1.12.2. With a minified production build, there is a difference of around 90kb compared to version 1.6. This difference does not seem to change with the amount of (user) code in the worker. This is all due to different version references of BN.js and couple of other duplicated dependencies in the core. In version 1.6, the bundle contains only one version of those dependencies hence a lot smaller in size. |
Just wanted to give an update here, we're introducing custom builds as part of #1818. After that merges, if you use custom builds, this will not longer be an issue. |
This sounds great. Please let us know when this is merged and I'll test again. Thanks. |
This should actually be fixed in #1722 |
🐛 Bug Report
Environment
rustc -V
: rustc 1.43.1node -v
: v14.3.0wrangler -V
: wrangler 1.9.2wrangler.toml
:Steps to reproduce
When building the project using wrangler v1.8 the size of the worker is
635Kib
:After upgrading to v1.9 it goes over the 1Mb limit:
This larger size is also confirmed when trying to publish the worker:
What did you expect to see?
Same size of the worker for the different versions of wrangler.
What did you see instead?
The size of the worker should not be different between wrangler versions.
I noticed this issue after upgrading to wrangler v1.9.0 #1188 (comment) but now I confirmed that the same thing is happening after using the latest release v1.9.2.
The text was updated successfully, but these errors were encountered: