Skip to content

Commit

Permalink
fix(nextjs): use 'next start' for serveStaticTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Jan 9, 2025
1 parent a9bd760 commit b6c38e8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/<%- appDirType %>/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/<%- appDirType %>/api-reference/config/typescript for more information.
20 changes: 10 additions & 10 deletions packages/next/src/plugins/__snapshots__/plugin.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ exports[`@nx/next/plugin integrated projects should create nodes 1`] = `
},
},
"my-serve-static": {
"executor": "@nx/web:file-server",
"command": "next start",
"dependsOn": [
"my-build",
],
"options": {
"buildTarget": "my-build",
"port": 3000,
"spa": false,
"staticFilePath": "{projectRoot}/out",
"cwd": "my-app",
},
},
"my-start": {
Expand Down Expand Up @@ -105,12 +105,12 @@ exports[`@nx/next/plugin root projects should create nodes 1`] = `
},
},
"serve-static": {
"executor": "@nx/web:file-server",
"command": "next start",
"dependsOn": [
"build",
],
"options": {
"buildTarget": "build",
"port": 3000,
"spa": false,
"staticFilePath": "{projectRoot}/out",
"cwd": ".",
},
},
"start": {
Expand Down
9 changes: 7 additions & 2 deletions packages/next/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export interface NextPluginOptions {
buildTargetName?: string;
devTargetName?: string;
startTargetName?: string;
/**
* @deprecated Use `startTargetName` instead.
*/
serveStaticTargetName?: string;
}

Expand Down Expand Up @@ -166,9 +169,11 @@ async function buildNextTargets(

targets[options.devTargetName] = getDevTargetConfig(projectRoot);

targets[options.startTargetName] = getStartTargetConfig(options, projectRoot);
const startTarget = getStartTargetConfig(options, projectRoot);

targets[options.serveStaticTargetName] = getStaticServeTargetConfig(options);
targets[options.startTargetName] = startTarget;

targets[options.serveStaticTargetName] = startTarget;

return targets;
}
Expand Down

0 comments on commit b6c38e8

Please sign in to comment.