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): remove serverBuildDirectory config #5703

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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/tame-moons-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": major
---

remove `serverBuildDirectory` config
37 changes: 4 additions & 33 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ export interface AppConfig {
*/
server?: string;

/**
* The path to the server build, relative to `remix.config.js`. Defaults to
* "build".
*
* @deprecated Use {@link AppConfig.serverBuildPath} instead.
*/
serverBuildDirectory?: string;

/**
* The path to the server build file, relative to `remix.config.js`. This file
* should end in a `.js` extension and should be deployed to your server.
Expand Down Expand Up @@ -373,7 +365,10 @@ export async function readConfig(
warnOnce(errorBoundaryWarning, "v2_errorBoundary");
}

let serverBuildPath = resolveServerBuildPath(rootDirectory, appConfig);
let serverBuildPath = path.resolve(
rootDirectory,
appConfig.serverBuildPath ?? "build/index.js"
);
let serverBuildTargetEntryModule = `export * from ${JSON.stringify(
serverBuildVirtualModule.id
)};`;
Expand Down Expand Up @@ -635,37 +630,13 @@ export function findConfig(
return undefined;
}

const resolveServerBuildPath = (
rootDirectory: string,
appConfig: AppConfig
) => {
let serverBuildPath = "build/index.js";

// retain deprecated behavior for now
if (appConfig.serverBuildDirectory) {
warnOnce(serverBuildDirectoryWarning, "serverBuildDirectory");

serverBuildPath = path.join(appConfig.serverBuildDirectory, "index.js");
}

if (appConfig.serverBuildPath) {
serverBuildPath = appConfig.serverBuildPath;
}

return path.resolve(rootDirectory, serverBuildPath);
};

// @ts-expect-error available in node 12+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat#browser_compatibility
let listFormat = new Intl.ListFormat("en", {
style: "long",
type: "conjunction",
});

export let serverBuildDirectoryWarning =
"⚠️ DEPRECATED: The `serverBuildDirectory` config option is deprecated. " +
"Use `serverBuildPath` instead.";

export let serverBuildTargetWarning =
"⚠️ DEPRECATED: The `serverBuildTarget` config option is deprecated. Use a " +
"combination of `publicPath`, `serverBuildPath`, `serverConditions`, " +
Expand Down