Skip to content
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

feat(remix-dev): serverBuildTarget deprecation warning #5624

Merged
merged 2 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/four-feet-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

serverBuildTarget deprecation warning
15 changes: 13 additions & 2 deletions docs/file-conventions/remix-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ to `"build/index.js"`.

## serverBuildTarget

<docs-warning>This option is deprecated and will likely be removed in a future
stable release. Use a combination of [`publicPath`][public-path],
<docs-warning>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],
Expand All @@ -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`
Expand Down
6 changes: 6 additions & 0 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? ""
);
Expand Down