Minimize the number of the Miniflare package dependencies#11897
Minimize the number of the Miniflare package dependencies#11897dario-piotrowicz merged 3 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 85a5041 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
I first think that was a change in your PR - I don't think it is, more an intent (but no related changes) right? |
276c611 to
820b018
Compare
Yes, sorry for the confusion, in that sentence I was describing the state of things more than what this PR is doing. |
7c95626 to
8464d64
Compare
|
@petebacondarwin This PR is moving some of the external dependencies to But now the CI check you added errors, and I can see explanations from you here as to why we'd want to avoid bundling those deps? Based on the tests passing I thought that it'd be ok, but there might be subtle untested consequences? If you are confident that these deps do need to be external I'm happy to close this PR, otherwise we can give this a go, please let me know 🙂 |
8464d64 to
a6eede3
Compare
Refine the approach to bundling dependencies: only bundle zod (pure JS library with no native dependencies) while keeping other dependencies external for technical reasons: - sharp: Native binary with platform-specific builds - undici: Dynamically required at runtime in worker threads (fetch-sync.ts) - ws: Has optional native bindings for performance optimization - workerd: Native binary (Cloudflare's JS runtime) - @cspotcode/source-map-support: Uses require.cache manipulation - youch: Dynamically required for lazy loading Also updated deps.ts comments to accurately document why each dependency must remain external.
aad69fc to
5bb6908
Compare
Fixes https://jira.cfdata.org/browse/DEVX-1578
This PR moves almost all the Miniflare dependencies to the devDependencies field ensuring that these get bundled in.
The non-bunbled packages are all pinned (which also prevents potential future npm vuln issues).
A picture of a cute animal (not mandatory, but encouraged)