remix icon indicating copy to clipboard operation
remix copied to clipboard

feat(remix-dev): add support for `fastly-compute-js` as `serverBuildTarget` value

Open harmony7 opened this issue 3 years ago • 5 comments

At Fastly we have created a runtime, a server adapter, and a template for running Remix on Fastly Compute@Edge. This PR adds support for settings serverBuildTarget to fastly-compute-js, which configures compiler settings to enable their use.

Our runtime, server adapter, and template are available at: https://github.com/fastly/remix-compute-js

These will work once this PR is accepted.

This PR adds:

  • Support for fastly-compute-js as an accepted value for serverBuildTarget in remix.config.js. This value:
    • Sets serverModuleFormat to "esm"
    • Sets serverPlatform to "neutral"
    • Causes esbuild config to:
      • use condition value of ["worker"]
      • use minify value of true
      • use mainFields value of ["browser", "module", "main"]
    • Causes serverBareModulesPlugin to always bundle everything

This PR is necessary because, except for the first two subitems in the list above, these behaviors cannot be set through remix.config.js.

This PR also adds the new value to the documentation page for the config file.

Relates to https://github.com/remix-run/remix/discussions/4613 as well as https://github.com/remix-run/remix/discussions/2888

harmony7 avatar Dec 14 '22 04:12 harmony7

🦋 Changeset detected

Latest commit: dcb6c79ade350c7ddbfb421b416aef8bca874332

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@remix-run/dev Minor
create-remix Minor
remix Minor
@remix-run/architect Minor
@remix-run/cloudflare Minor
@remix-run/cloudflare-pages Minor
@remix-run/cloudflare-workers Minor
@remix-run/deno Minor
@remix-run/eslint-config Minor
@remix-run/express Minor
@remix-run/netlify Minor
@remix-run/node Minor
@remix-run/react Minor
@remix-run/serve Minor
@remix-run/server-runtime Minor
@remix-run/testing Minor
@remix-run/vercel Minor

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

changeset-bot[bot] avatar Dec 14 '22 04:12 changeset-bot[bot]

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

remix-cla-bot[bot] avatar Dec 14 '22 04:12 remix-cla-bot[bot]

I've also added a changeset, please let me know if this is sufficient or if it needs changing.

harmony7 avatar Dec 14 '22 04:12 harmony7

Nice, thanks.

harmony7 avatar Dec 14 '22 11:12 harmony7

Thanks for your update. I have been following #4841 as well, and your comments make sense. As soon as that one lands the code-based changes in this PR will not be necessary (However I'd still like to submit updates to the docs to make Fastly discoverable).

harmony7 avatar Jan 23 '23 02:01 harmony7

Closing this as #4841 is now merged

Once that's released, the fastly template can use these new config options.

@harmony7 If you want to add the template and/or adapter to our docs like @penx did in #5254, feel free to open a new PR for that 🙏

MichaelDeBoey avatar Feb 02 '23 21:02 MichaelDeBoey

awesome, thanks!

@harmony7 If you want to add the template and/or adapter to our docs like @penx did in https://github.com/remix-run/remix/pull/5254, feel free to open a new PR for that

I certainly will do that =) thanks

harmony7 avatar Feb 03 '23 01:02 harmony7

@MichaelDeBoey have filed PR #5370 . Please take a look.

harmony7 avatar Feb 06 '23 03:02 harmony7