v1.2.0
We've been plugging away at a few important features and improvements for this release, so buckle up and get ready for a ride 🚀 (click here for a quick breakdown of all changes)
New Feature: serverBuildTarget
In v1.2 we are doubling down on the power—and improving the simplicity—of integrating your server with your app. This release introduces a new config option serverBuildTarget
that removes some of the overhead of configuring Remix to interface with your deploy target, and it's an important first step towards being able to move your application with greater ease as requirements change.
When you specify a build target, Remix will take care of configuring other details like the build directory and module format. serverBuildTarget
supports a number of deployment platforms and runtimes:
"node-cjs"
"arc"
"netlify"
"vercel"
"cloudflare-pages"
"cloudflare-workers"
"deno"
👀
If this option is not set, your app works exactly as it did before. If you bootstrapped your app with the Remix App Server or are using your own Node server, we suggest setting this option to "node-cjs"
.
New Feature: Single-file server builds
In addition to simplifying server configuration, we've also introduced a way for users to compile their server along with their app using the new server
config option. This setting is optional, points to the path of your custom server, and allows Remix to compile your server and app to a single file.
What does this mean for you? If you are deploying to Cloudflare Workers, this allows you to remove the secondary build step, as our compiler takes care of everything for you. It also means you can write your custom server in TypeScript 🥳
Custom server code example
// remix.config.js
module.exports = {
server: "./server.ts"
};
// server.ts
import express from "express";
// Import the output of your server build from a Remix virtual module
import * as serverBuild from "@remix-run/dev/server-build";
let app = express();
app.all(
"*",
createRequestHandler({
build: serverBuild
})
);
If this option is not set, your app works as it did before, and you will continue to import the output from your server build directory instead of our new virtual module. Also note that with this new capability we have deprecated serverBuildDirectory
and suggest that you use serverBuildPath
instead.
New Feature: Browser shims for Node built-ins
Remix can now add polyfills for built-in node_modules
in the browser. This is really useful if you need to access utilities like path
or read from process
in your client code. It should also make migrating your Webpack projects to Remix a breeze.
These shims are only used if you use Node built-ins in client code. Remix already tree-shakes server code out of your client bundles, so if you don't use these modules outside of your loaders and actions this won't change anything for you. But it can prevent nasty failures at runtime if you do!
New Feature: Using ESM-only packages on node
We added a serverDependenciesToBundle
config option that tells Remix which dependencies to include in your server bundle when using the node-cjs
build target. This allows you to use packages that publish only ESM in your CommonJS output.
Using ESM-only packages on node
// remix.config.js
module.exports = {
serverDependenciesToBundle: [
"remark"
]
};
🧪 Experimental Feature: Deno adapter
If you've read this far, you may have noticed an interesting little detail in our new serverBuildTarget
options. We now provide an adapter package to deploy to Deno, and we've added this option to the create-remix
CLI 🤯
We are very excited about Deno and bullish on its future, so providing first-class support is a huge step towards supporting the Deno ecosystem. It's still the early days in this space and we'd love your help battle testing our adapter to make Remix and Deno a rock-solid force to be reckoned with. 💪
TLDR: What Changed?
✨ Features
- New
serverBuildTarget
config option to specify your deployment target and simplify integration with your Remix adapter - New
server
config option that allows us to compile your server and app into a single file. This allows for simpler deployment, as well as eliminating the secondary build step for users deploying to Cloudflare Workers or writing their server code in TypeScript. - Add DynamoDB tables session storage for
@remix-run/architect
(#1538) - 🧪 EXPERIMENTAL New Deno adapter! You can now install
@remix-run/deno
or bootstrap your app by selectingdeno
in thecreate-remix
CLI.
💅 Enhancements
- Dev server should watch
remix.config.js
server file (#1605) remix dev
should now find an available port if the default port isn't available (#871 + #1352)process.env.NODE_ENV
check is no longer needed for<LiveReload />
(#1352)- Added support for binary data responses in
@remix-run/architect
and@remix-run/netlify
(#1780) - Implemented a minimum version check for Node to prevent confusing crash logs (#1586)
- Lots of error message improvements! 🙏
🐛 Bug fixes
- Allow for streams to be returned as the response body in
@remix-run/vercel
(#1470) - Fix forwarding of request cookie headers in
@remix-run/architect
(#1709) - Fix a bug preventing
remix dev
andremix serve
from running offline (#1743) - Fix support for submit buttons outside of their form element in
<Form>
(#1781) - Fix both
Link
andNavLink
to ensure prefetch works with explicit event handlers by (#1783) - Add Netlify-specific context to Remix server actions when used with
@remix-run/netlify
(#1835) - Fix a bug where numerical URL targets caused sites to hang and crash (#936)
- Fix the DynamoDB key for
arcTableSessionStorage
anddeleteData
in@remix-run/architect
(#1863) - Fix a bug where
FormData
methods would returnnull
for empty strings (#1869) - Fixed a bug where a button's data was missing if the user clicked on a nested element inside the button (#1240)
- Reset
useFetcher().submission
state back to"idle"
after a redirect (#1875) - Fixed native
_redirects
support for Cloudflare Pages by (#1237) - Added missing
statusText
to responses in@remix-run/express
and@remix-run/vercel
(#1234)
☠️ Deprecated
remix.config.js
serverBuildDirectory
is deprecated; useserverBuildPath
insteadserverModuleFormat
andserverPlatform
are both deprecated; useserverBuildTarget
instead
New Contributors
- @mbarto made their first contribution in #1470
- @jamiebuilds made their first contribution in #1649
- @confix made their first contribution in #1709
- @Runner-dev made their first contribution in #1718
- @nwalters512 made their first contribution in #1716
- @sdavids made their first contribution in #1712
- @gabimor made their first contribution in #1699
- @lionotm made their first contribution in #1692
- @omamazainab made their first contribution in #1689
- @hadizz made their first contribution in #1684
- @jdeniau made their first contribution in #1675
- @toyozaki made their first contribution in #1665
- @Dueen made their first contribution in #1727
- @himorishige made their first contribution in #1674
- @AaronPowell96 made their first contribution in #1639
- @gunners6518 made their first contribution in #1647
- @RomanSavarin made their first contribution in #1646
- @anmolm96 made their first contribution in #1630
- @sndrem made their first contribution in #1612
- @joms made their first contribution in #1602
- @kanermichael made their first contribution in #1600
- @LucasDibz made their first contribution in #1599
- @damiensedgwick made their first contribution in #1584
- @mkrtchian made their first contribution in #1735
- @monitaure made their first contribution in #1746
- @manosim made their first contribution in #1147
- @lpsinger made their first contribution in #1538
- @jenseng made their first contribution in #1783
- @sandulat made their first contribution in #1473
- @ninjaPixel made their first contribution in #1833
- @alex-ketch made their first contribution in #1771
- @jgarrow made their first contribution in #1805
- @abotsi made their first contribution in #1505
- @bsides made their first contribution in #1476
- @maferland made their first contribution in #1471
- @jacobparis made their first contribution in #1430
- @MatthewAlbrecht made their first contribution in #1427
- @ValentinH made their first contribution in #1284
- @lawrencecchen made their first contribution in #1241
- @denissb made their first contribution in #1231
- @rtabulov made their first contribution in #1218
- @jvnm-dev made their first contribution in #1205
- @mantey-github made their first contribution in #1169
- @simonswiss made their first contribution in #1813
- @raulrpearson made their first contribution in #1784
- @gsaandy made their first contribution in #1762
- @knowler made their first contribution in #1742
- @catnose99 made their first contribution in #1662
- @bustamantedev made their first contribution in #1565
- @anmonteiro made their first contribution in #1835
- @marcomafessolli made their first contribution in #1440
- @rvlewerissa made their first contribution in #1436
- @cysp made their first contribution in #1431
- @camiaei made their first contribution in #1296
- @guerra08 made their first contribution in #1634
- @andrelandgraf made their first contribution in #1669
- @MirzaFaizan made their first contribution in #1855
- @sbernheim4 made their first contribution in #1213
- @jesse-deboer made their first contribution in #1154
- @eldarshamukhamedov made their first contribution in #739
- @xstevenyung made their first contribution in #1847
- @luk-str made their first contribution in #1872
- @vimutti77 made their first contribution in #1477
- @edmundhung made their first contribution in #1240
- @selfish made their first contribution in #1789
- @joshball made their first contribution in #1760
- @luistak made their first contribution in #1638
- @mattcoffyn made their first contribution in #1573
- @c43721 made their first contribution in #1563
- @BogdanDevBst made their first contribution in #1353
- @michaseel made their first contribution in #1350
- @robindrost made their first contribution in #1346
- @ryankshaw made their first contribution in #1345
- @anubra266 made their first contribution in #1306
- @aaronshaf made their first contribution in #1245
- @oott123 made their first contribution in #1235
- @squidpunch made their first contribution in #1199
- @gkueny made their first contribution in #1157
- @lukahartwig made their first contribution in #1146
- @jssisodiya made their first contribution in #1130
- @antoninbeaufort made their first contribution in #1496
- @manzano78 made their first contribution in #1888
- @mikeybinnswebdesign made their first contribution in #832
- @rowinbot made their first contribution in #702
- @airondumael made their first contribution in #679
- @schpet made their first contribution in #1836
- @BenMcH made their first contribution in #1927
- @ghaagsma made their first contribution in #1961
- @nordiauwu made their first contribution in #1941
- @niwsa made their first contribution in #1925
Full Changelog: v1.1.3...v1.2.0