Skip to content

Commit

Permalink
fix(nextjs): Custom server should run on fresh apps without errors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham authored Jun 27, 2023
1 parent d4d48fb commit bd7157b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/js/src/executors/node/node.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,19 @@ export async function* nodeExecutor(

// Re-map buildable workspace projects to their output directory.
const mappings = calculateResolveMappings(context, options);

const outputFileName =
buildOptions.outputFileName ?? `${path.parse(buildOptions.main).name}.js`;
let outputFileName =
buildOptions.outputFileName || `${path.parse(buildOptions.main).name}.js`;

if (!buildOptions.outputFileName) {
const matches = buildOptions.main.match(/^(?!.*src)(.*)\/([^/]*)$/); //ignore strings that contain src and split paths into [folders before main, main.ts]
if (matches) {
const [mainFolder, mainFileName] = matches.slice(1);
outputFileName = path.join(
mainFolder,
`${path.parse(mainFileName).name}.js`
);
}
}

const fileToRun = join(context.root, buildOptions.outputPath, outputFileName);
const tasks: ActiveTask[] = [];
Expand Down

1 comment on commit bd7157b

@vercel
Copy link

@vercel vercel bot commented on bd7157b Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx.dev
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app

Please sign in to comment.