feat: Allow for custom server to participate in bundling#1504
Conversation
|
I think we need another |
That's already solved. None of our outputs, bundled or not, will include an |
|
I'd like to run through the templates and make sure everything works before we merge this.... I haven't done that yet. |
|
Good plan for a PR like this, but also we'll catch that stuff now in pre-releases! #1408 |
if you're feeling adventurous, you can gather and export all the "TEST_" prefixed ones from https://github.com/remix-run/remix/settings/secrets/actions to your shell and run ... or just cut an experimental and 🤞 |
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Remix Run Bot <hello@remix.run>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
mjackson
left a comment
There was a problem hiding this comment.
Initial review. Looks good! Let's go through the templates later.
- add remix config options back to convey defaults - separated out default entries to their own files - address PR feedback
| const handleRequest = createPagesFunctionHandler({ | ||
| build, | ||
| mode: process.env.NODE_ENV, | ||
| getLoadContext: context => context.env |
There was a problem hiding this comment.
Let's add something to the docs about this. Maybe @kentcdodds can help us show people how to automatically access their durable objects in a loader or something.
- removed vercel specific logic from the compiler - update customServer config name in internal config
|
Let's talk about this tomorrow, but I think if we can move all the vendor-specific code to the adapters that would be important. @jacob-ebey mentioned @mjackson and he had already discussed this, but I would like to push back on the decision to include hosting provider code in our compiler. If any of these hosting providers change where they want the output or anything else we need to do a major version bump of the compiler (think Babel pre-v6 when they included all the transform plugins within babel itself). Not a great situation to be in when we don't control the breaking changes of our own compiler code 😬 |
|
That's a great point @kentcdodds. I spoke with @jacob-ebey about it and I think we'll just remove the defaults server entry code from our compiler. Instead, we'll just dump it into the project directly when someone runs |
|
Sounds much better. Just don't want a host to trigger a breaking change in our compiler 👍 |
- removed build target check in dev command
- rename customServer to just server
|
Nice work getting this done, @jacob-ebey! Can't wait to release this next week 🙌 |
|
Nifty. Does this also address https://discord.com/channels/770287896669978684/935307164308881419? |
Inspired by remix-run/remix#1504
feat: introduces virtual module
@remix-run/assets-manifestthat contains the client asset manifestWe previously wrote out a json file in the server build directory outside of the bundler. this introduced the requirement of another external bundle step for any deployment platform that requires a single file.
feat: introduces virtual module
@remix-run/server-buildthat is the module that is currently output as the server bundleWe previously piped this into esbuild stdin, but with the introduction of
customServerbeing able to participate in bundling we needed a way to access the "finalized" remix server build before the build finishes 🤯feat: introduces
serverBuildTargetconfig option and deprecatesserverModuleFormatandserverPlatformserverBuildTargetnow configures defaults in the compiler for you that look like this:If a
serverBuildTargetis set besidesnode-cjsand acustomServeris not provided, the output module for the server build will now be a "ready to go" file for that build target. IfserverBuildTargetis not defined ornode-cjsthe output module is the same format as today.feat: explicitly exclude
@remix-run/server-runtime,@remix-run/node,@remix-run/cloudflare-pages,@remix-run/cloudflare-workers,@remix-run/denofrom client bundles. This may introduce new runtime errors in existing projects that are currently bundling server modules in the client by accident. Usingxxx.server.jspattern will fix these issues for people who run into issues.