Skip to content
New issue

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

feat(cloudflare-pages): improve cloudflare-pages adaptor to use dynamic imports #1531

Conversation

dario-piotrowicz
Copy link
Contributor

Warning
Opening this as a draft since it looks like wrangler needs a small tweak to enable this: cloudflare/workers-sdk#3707

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Update the Cloudflare Pages to use dynamic imports instead of bundling all the js into a single _worker.js file, this should make the adapter more performant and potentially reduce startup time

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@Hebilicious
Copy link
Contributor

I'll tag this as pending until cloudflare/workers-sdk#3707 is merged πŸ‘πŸ½

@Hebilicious Hebilicious added the enhancement New feature or request label Aug 4, 2023
@pi0 pi0 changed the base branch from main to feat/split-workers August 6, 2023 18:29
@nuxt-studio
Copy link
Contributor

nuxt-studio bot commented Aug 6, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
nitro Edit on Studio β†—οΈŽ View Live Preview e855941

@pi0 pi0 changed the base branch from feat/split-workers to main August 6, 2023 18:34
@pi0 pi0 changed the base branch from main to feat/split-workers August 6, 2023 18:34
@pi0 pi0 marked this pull request as ready for review August 6, 2023 18:35
@pi0 pi0 merged commit 4e30c9c into nitrojs:feat/split-workers Aug 6, 2023
1 check passed
@pi0
Copy link
Member

pi0 commented Aug 6, 2023

Thanks for the PR and followups dear @dario-piotrowicz ❀️ I have merged your work into #1172 from @danielroe to track both module and pages enabling from one place.

@dario-piotrowicz
Copy link
Contributor Author

Hi @pi0 I did open this PR separately because the pages dynamic imports should be available very soon (after
cloudflare/workers-sdk#3707 is merged and a new version of wrangler is released)

Unfortunately I don't have an ETA as to when this is going to be available for workers.

So I was hoping that we could start using dynamic imports in the pages adaptor now and then do that in the module worker adaptor whenever possible.

If you believe that the two adaptors should be updated simultaneously I understand πŸ™‚
(but again I am not sure when the worker lazy loading will be properly supported πŸ˜“)

@pi0
Copy link
Member

pi0 commented Aug 6, 2023

Oh, thanks for the explanations wasn't aware of separate roadmaps. I can happily reopen here to speed it up or merge daniel's PR via an opt-in futuristic flag to make sure nitro is readt already (and somehow locally tested).

Also BTW we have an UnJS discord channel for team communications. Would you be interested to join? (please DM me at pi0)

@dario-piotrowicz
Copy link
Contributor Author

dario-piotrowicz commented Aug 7, 2023

@pi0 just pinged you on discord πŸ™‚

Regarding Pages and Workers having different roadmaps (or more specifically just slightly different implementations/issues), sorry my bad for not mentioning anything in the PR's description πŸ™‡

Regarding this PR vs merging Daniel's I'm fine with whatever you prefer πŸ™‚ (as long as we don't break the Workers adaptor naturally), although we can't test the lazy loading worker adaptor right now and be sure that it is actually fully ready (since there's not yet a wrangler built which fixes the workers' lazy loading issue), so if we were to go with Daniel's PR there might still be a small chance that things will still need to be tweaked later on (which again, it's not terrible and I'd be fine with if that's an acceptable situation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants