-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
templates(classic-compiler/cloudflare-workers): use static assets #10041
base: main
Are you sure you want to change the base?
Conversation
|
Hi @zwily, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Actually, something is wrong here... When I edit a file in dev and it rebuilds, the local server reloads a ton of times:
I'll try to track that down. |
I have submitted a PR to wrangler to fix the issue: |
OK, wrangler is fixed and this template is pulling the right version. Wrangler is also logging every file change on every build which is obnoxious, but not breaking. I have another PR for that here: cloudflare/workers-sdk#6873 but that shouldn't block this. |
4aeca3a
to
1383e86
Compare
Okay, this template is in working shape now with current wrangler. (The only thing is we have |
@zwily It seems the mentioned bug is now fixed? |
Putting the "npm run build" command in wrangler.toml was causing wrangler to rebuild the app when it started, which is not necessary because remix itself handles the build. Instead we have wrangler not run the build, and run `npm run build` before deploy instead.
There's an ongoing issue with multiple reloads with the new x-dev-env, so we're turning it off for now: cloudflare/workers-sdk#6876
We can't bundle "cloudflare:workers", but that will be imported when writing a DurableObject with RPC.
67a99bd
to
ddf99f6
Compare
This PR updates the classic-remix-compiler/cloudflare-workers template to use the new Static Assets feature. It also modernizes the template to match the current vite ones as much as possible. (Includes tailwind by default, uses
load-context.ts
for augmenting context, etc)A separate PR (#10034) is open to update the vite template, but this is for the classic compiler. There are a couple reasons to not use vite with cloudflare yet:
Once Vite 6 comes out with Vite Environments and your code can run in wrangler, this won't be necessary. But for now it is for at least some of us.
Testing Strategy:
To test, please run create-remix with the template on my fork
Then deploy it with wrangler by running: