Skip to content

Commit

Permalink
feat(remix-dev)!: remove serverBuildDirectory config option (#6897)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Jul 20, 2023
1 parent 94ec5cf commit 04e0749
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 41 deletions.
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 option
45 changes: 4 additions & 41 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,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 @@ -429,7 +421,10 @@ export async function readConfig(
headersWarning();
}

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 @@ -882,26 +877,6 @@ export function findConfig(
return undefined;
}

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

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

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

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

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

// adds types for `Intl.ListFormat` to the global namespace
// we could also update our `tsconfig.json` to include `lib: ["es2021"]`
declare namespace Intl {
Expand Down Expand Up @@ -939,18 +914,6 @@ let disjunctionListFormat = new Intl.ListFormat("en", {
type: "disjunction",
});

let serverBuildDirectoryWarning = () =>
logger.warn(
"The `serverBuildDirectory` config option will be removed in v2",
{
details: [
"You can use the `serverBuildPath` config option instead.",
"-> https://remix.run/docs/en/v1.15.0/pages/v2#serverbuilddirectory",
],
key: "serverBuildDirectoryWarning",
}
);

let serverModuleFormatWarning = () =>
logger.warn("The default server module format is changing in v2", {
details: [
Expand Down

0 comments on commit 04e0749

Please sign in to comment.