Skip to content

Commit ee443c6

Browse files
committed
fix(nextjs): use 'next start' for serveStaticTarget
1 parent fb8ee1f commit ee443c6

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

Diff for: packages/next/src/generators/application/files/common/next-env.d.ts__tmpl__

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/<%- appDirType %>/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/<%- appDirType %>/api-reference/config/typescript for more information.

Diff for: packages/next/src/plugins/__snapshots__/plugin.spec.ts.snap

+10-10
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ exports[`@nx/next/plugin integrated projects should create nodes 1`] = `
4040
},
4141
},
4242
"my-serve-static": {
43-
"executor": "@nx/web:file-server",
43+
"command": "next start",
44+
"dependsOn": [
45+
"my-build",
46+
],
4447
"options": {
45-
"buildTarget": "my-build",
46-
"port": 3000,
47-
"spa": false,
48-
"staticFilePath": "{projectRoot}/out",
48+
"cwd": "my-app",
4949
},
5050
},
5151
"my-start": {
@@ -105,12 +105,12 @@ exports[`@nx/next/plugin root projects should create nodes 1`] = `
105105
},
106106
},
107107
"serve-static": {
108-
"executor": "@nx/web:file-server",
108+
"command": "next start",
109+
"dependsOn": [
110+
"build",
111+
],
109112
"options": {
110-
"buildTarget": "build",
111-
"port": 3000,
112-
"spa": false,
113-
"staticFilePath": "{projectRoot}/out",
113+
"cwd": ".",
114114
},
115115
},
116116
"start": {

Diff for: packages/next/src/plugins/plugin.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export interface NextPluginOptions {
2626
buildTargetName?: string;
2727
devTargetName?: string;
2828
startTargetName?: string;
29+
/**
30+
* @deprecated Use `startTargetName` instead.
31+
*/
2932
serveStaticTargetName?: string;
3033
}
3134

@@ -166,9 +169,11 @@ async function buildNextTargets(
166169

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

169-
targets[options.startTargetName] = getStartTargetConfig(options, projectRoot);
172+
const startTarget = getStartTargetConfig(options, projectRoot);
170173

171-
targets[options.serveStaticTargetName] = getStaticServeTargetConfig(options);
174+
targets[options.startTargetName] = startTarget;
175+
176+
targets[options.serveStaticTargetName] = startTarget;
172177

173178
return targets;
174179
}

0 commit comments

Comments
 (0)