From 37b5720fdda1ef79ea99c2aaa54018fdbbe74337 Mon Sep 17 00:00:00 2001 From: Jacob Ebey Date: Wed, 1 Mar 2023 12:09:23 -0800 Subject: [PATCH] feat(remix-dev): serverBuildTarget deprecation warning docs: add serverBuildTarget migration table --- docs/file-conventions/remix-config.md | 15 +++++++++++++-- packages/remix-dev/config.ts | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/file-conventions/remix-config.md b/docs/file-conventions/remix-config.md index 3a975ed16f6..f2b4e5e54c1 100644 --- a/docs/file-conventions/remix-config.md +++ b/docs/file-conventions/remix-config.md @@ -116,8 +116,7 @@ to `"build/index.js"`. ## serverBuildTarget -This option is deprecated and will likely be removed in a future -stable release. Use a combination of [`publicPath`][public-path], +This option is deprecated and will be removed in the next major version release. Use a combination of [`publicPath`][public-path], [`serverBuildPath`][server-build-path], [`serverConditions`][server-conditions], [`serverDependenciesToBundle`][server-dependencies-to-bundle] [`serverMainFields`][server-main-fields], [`serverMinify`][server-minify], @@ -136,6 +135,18 @@ The `serverBuildTarget` can be one of the following: - [`"node-cjs"`][node-cjs] - [`"vercel"`][vercel] +**Migration Table:** + +| serverBuildTarget | publicPath | serverBuildPath | serverConditions | serverMainFields | serverModuleFormat | serverPlatform | serverDependenciesToBundle | serverMinify | +| -------------------- | ------------------ | --------------------------------------- | ---------------- | ----------------------- | ------------------ | -------------- | -------------------------- | ------------ | +| `arc` | `/\_static/build/` | `server/index.js` | | `main, module` | `cjs` | `node` | | `false` | +| `cloudflare-pages` | `/build/` | `functions/[[path]].js` | `worker` | `browser, module, main` | `esm` | `neutral` | `all` | `true` | +| `cloudflare-workers` | `/build/` | `build/index.js` | `worker` | `browser, module, main` | `esm` | `neutral` | `all` | `true` | +| `deno` | `/build/` | `build/index.js` | `deno, worker` | `module, main` | `esm` | `neutral` | `all` | `false` | +| `netlify` | `/build/` | `.netlify/functions-internal/server.js` | | `main, module` | `cjs` | `node` | | `false` | +| `node-cjs` | `/build/` | `build/index.js` | | `main, module` | `cjs` | `node` | | `false` | +| `vercel` | `/build/` | `api/index.js` | | `main, module` | `cjs` | `node` | | `false` | + ## serverConditions The order of conditions to use when resolving server dependencies' `exports` diff --git a/packages/remix-dev/config.ts b/packages/remix-dev/config.ts index 77589404d72..b89239d1a12 100644 --- a/packages/remix-dev/config.ts +++ b/packages/remix-dev/config.ts @@ -396,6 +396,12 @@ export async function readConfig( } } + if (appConfig.serverBuildTarget) { + console.warn( + `The "serverBuildTarget" config option is deprecated. Use a combination of "publicPath", "serverBuildPath", "serverConditions", "serverDependenciesToBundle", "serverMainFields", "serverMinify", "serverModuleFormat" and/or "serverPlatform" instead.` + ); + } + let isCloudflareRuntime = ["cloudflare-pages", "cloudflare-workers"].includes( appConfig.serverBuildTarget ?? "" );