Skip to content

Commit

Permalink
feat(remix-dev)!: remove serverBuildDirectory config option
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Jul 20, 2023
1 parent a10d371 commit cda0086
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 @@ -135,14 +135,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 @@ -437,7 +429,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 @@ -896,26 +891,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 @@ -965,18 +940,6 @@ let browserBuildDirectoryWarning = () =>
}
);

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 cda0086

Please sign in to comment.