Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
a0cc4aa6
Unverified
Commit
a0cc4aa6
authored
Jun 21, 2023
by
Shu Ding
Committed by
GitHub
Jun 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fix standalone not found" (#51506)
Reverts vercel/next.js#51172 Fixes #51482.
parent
c1c3675f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
31 deletions
+7
-31
utils.ts
packages/next/src/build/utils.ts
+4
-6
render-server-standalone.ts
packages/next/src/server/lib/render-server-standalone.ts
+3
-8
not-found.js
test/e2e/app-dir/app/app/dashboard/not-found.js
+0
-3
not-found.js
...on/standalone-mode/required-server-files/app/not-found.js
+0
-3
next.config.js
...tion/standalone-mode/required-server-files/next.config.js
+0
-3
required-server-files-app.test.ts
...e/required-server-files/required-server-files-app.test.ts
+0
-8
No files found.
packages/next/src/build/utils.ts
View file @
a0cc4aa6
...
@@ -1928,21 +1928,20 @@ export async function copyTracedFiles(
...
@@ -1928,21 +1928,20 @@ export async function copyTracedFiles(
serverOutputPath
,
serverOutputPath
,
`
${
`
${
moduleType
moduleType
?
`\
?
`import http from 'http'
import http from 'http'
import path from 'path'
import path from 'path'
import { fileURLToPath } from 'url'
import { fileURLToPath } from 'url'
import { createServerHandler } from 'next/dist/server/lib/render-server-standalone.js'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
const __dirname = fileURLToPath(new URL('.', import.meta.url))
import { createServerHandler } from 'next/dist/server/lib/render-server-standalone.js'
`
`
:
`
\
:
`
const http = require('http')
const http = require('http')
const path = require('path')
const path = require('path')
const { createServerHandler } = require('next/dist/server/lib/render-server-standalone')`
const { createServerHandler } = require('next/dist/server/lib/render-server-standalone')`
}
}
const dir = path.join(__dirname)
const dir = path.join(__dirname)
process.env.NODE_ENV = 'production'
process.env.NODE_ENV = 'production'
process.chdir(__dirname)
process.chdir(__dirname)
...
@@ -1963,7 +1962,6 @@ const nextConfig = ${JSON.stringify({
...
@@ -1963,7 +1962,6 @@ const nextConfig = ${JSON.stringify({
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
createServerHandler({
createServerHandler({
port: currentPort,
port: currentPort,
hostname,
hostname,
...
...
packages/next/src/server/lib/render-server-standalone.ts
View file @
a0cc4aa6
...
@@ -5,6 +5,8 @@ import httpProxy from 'next/dist/compiled/http-proxy'
...
@@ -5,6 +5,8 @@ import httpProxy from 'next/dist/compiled/http-proxy'
import
{
Worker
}
from
'next/dist/compiled/jest-worker'
import
{
Worker
}
from
'next/dist/compiled/jest-worker'
import
{
normalizeRepeatedSlashes
}
from
'../../shared/lib/utils'
import
{
normalizeRepeatedSlashes
}
from
'../../shared/lib/utils'
const
renderServerPath
=
require
.
resolve
(
'./render-server'
)
export
const
createServerHandler
=
async
({
export
const
createServerHandler
=
async
({
port
,
port
,
hostname
,
hostname
,
...
@@ -18,20 +20,13 @@ export const createServerHandler = async ({
...
@@ -18,20 +20,13 @@ export const createServerHandler = async ({
dev
?:
boolean
dev
?:
boolean
minimalMode
:
boolean
minimalMode
:
boolean
})
=>
{
})
=>
{
const
nextConfig
=
JSON
.
parse
(
const
routerWorker
=
new
Worker
(
renderServerPath
,
{
process
.
env
.
__NEXT_PRIVATE_STANDALONE_CONFIG
||
'{}'
)
const
routerWorker
=
new
Worker
(
require
.
resolve
(
'./render-server'
),
{
numWorkers
:
1
,
numWorkers
:
1
,
maxRetries
:
10
,
maxRetries
:
10
,
forkOptions
:
{
forkOptions
:
{
env
:
{
env
:
{
FORCE_COLOR
:
'1'
,
FORCE_COLOR
:
'1'
,
...
process
.
env
,
...
process
.
env
,
__NEXT_PRIVATE_PREBUNDLED_REACT
:
nextConfig
?.
experimental
?.
useServerActions
?
'experimental'
:
'next'
,
},
},
},
},
exposedMethods
:
[
'initialize'
],
exposedMethods
:
[
'initialize'
],
...
...
test/e2e/app-dir/app/app/dashboard/not-found.js
deleted
100644 → 0
View file @
c1c3675f
export
default
function
NotFound
()
{
return
'dashboard not found'
}
test/production/standalone-mode/required-server-files/app/not-found.js
deleted
100644 → 0
View file @
c1c3675f
export
default
function
page
()
{
return
'not-found-page-404'
}
test/production/standalone-mode/required-server-files/next.config.js
deleted
100644 → 0
View file @
c1c3675f
module
.
exports
=
{
output
:
'standalone'
,
}
test/production/standalone-mode/required-server-files/required-server-files-app.test.ts
View file @
a0cc4aa6
...
@@ -127,12 +127,4 @@ describe('should set-up next', () => {
...
@@ -127,12 +127,4 @@ describe('should set-up next', () => {
expect
(
res
.
headers
.
get
(
'x-next-cache-tags'
)).
toBeFalsy
()
expect
(
res
.
headers
.
get
(
'x-next-cache-tags'
)).
toBeFalsy
()
}
}
})
})
it
(
'should handle correctly not-found.js'
,
async
()
=>
{
const
res
=
await
fetchViaHTTP
(
appPort
,
'/not-found/does-not-exist'
)
expect
(
res
.
status
).
toBe
(
404
)
const
html
=
await
res
.
text
()
expect
(
html
).
toContain
(
'not-found-page-404'
)
expect
(
html
).
not
.
toContain
(
'not-found-page-200'
)
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment