Skip to content

Commit

Permalink
Print warning if entry.server file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Feb 27, 2024
1 parent 0efc196 commit 17f655c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/vercel-remix/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,24 @@ export function vercelPreset(): Preset {

// If there are any "edge" runtime routes, then a special
// `entry.server` needs to be used. So copy that file into
// the app directory, unless the project has defined their own
// the app directory.
if (config.runtime === "edge" && !entryServerPath) {
let appDirectory = remixUserConfig.appDirectory ?? "app";

// Print a warning if the project has an `entry.server` file
let entryServerFile = readdirSync(appDirectory).find(
(f) => basename(f, extname(f)) === 'entry.server'
);
if (entryServerFile) {
console.warn(
`WARN: Vercel uses its own \`enter.server\` file, so the file "${join(
appDirectory,
entryServerFile
)}" has been deleted.`
);
console.warn(`WARN: You should commit this change.`);
}

entryServerPath = join(appDirectory, "entry.server.jsx");
cpSync(join(__dirname, "defaults/entry.server.jsx"), entryServerPath);
}
Expand Down

0 comments on commit 17f655c

Please sign in to comment.