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
f16f868e
Unverified
Commit
f16f868e
authored
Oct 30, 2019
by
JJ Kasper
Committed by
GitHub
Oct 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure to handle paths with dot in name for SPR (#9227)
parent
8dd394a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
worker.js
packages/next/export/worker.js
+17
-1
index.js
test/integration/prerender/pages/blog/[post]/index.js
+6
-1
index.test.js
test/integration/prerender/test/index.test.js
+5
-0
No files found.
packages/next/export/worker.js
View file @
f16f868e
...
...
@@ -93,7 +93,7 @@ export default async function ({
}
const
baseDir
=
join
(
outDir
,
dirname
(
htmlFilename
))
cons
t
htmlFilepath
=
join
(
outDir
,
htmlFilename
)
le
t
htmlFilepath
=
join
(
outDir
,
htmlFilename
)
await
mkdirp
(
baseDir
)
let
html
...
...
@@ -117,6 +117,12 @@ export default async function ({
// prerendered the file
if
(
renderedDuringBuild
(
mod
.
unstable_getStaticProps
))
return
results
if
(
mod
.
unstable_getStaticProps
&&
!
htmlFilepath
.
endsWith
(
'.html'
))
{
// make sure it ends with .html if the name contains a dot
htmlFilename
+=
'.html'
htmlFilepath
+=
'.html'
}
renderMethod
=
mod
.
renderReqToHTML
const
result
=
await
renderMethod
(
req
,
res
,
true
)
curRenderOpts
=
result
.
renderOpts
||
{}
...
...
@@ -139,6 +145,16 @@ export default async function ({
return
results
}
// TODO: de-dupe the logic here between serverless and server mode
if
(
components
.
unstable_getStaticProps
&&
!
htmlFilepath
.
endsWith
(
'.html'
)
)
{
// make sure it ends with .html if the name contains a dot
htmlFilepath
+=
'.html'
htmlFilename
+=
'.html'
}
if
(
typeof
components
.
Component
===
'string'
)
{
html
=
components
.
Component
}
else
{
...
...
test/integration/prerender/pages/blog/[post]/index.js
View file @
f16f868e
...
...
@@ -3,7 +3,12 @@ import Link from 'next/link'
// eslint-disable-next-line camelcase
export
async
function
unstable_getStaticParams
()
{
return
[
'/blog/post-1'
,
{
post
:
'post-2'
},
'/blog/[post3]'
]
return
[
'/blog/post-1'
,
{
post
:
'post-2'
},
'/blog/[post3]'
,
'/blog/post.1'
]
}
// eslint-disable-next-line camelcase
...
...
test/integration/prerender/test/index.test.js
View file @
f16f868e
...
...
@@ -75,6 +75,11 @@ const expectedManifestRoutes = () => ({
initialRevalidateSeconds
:
2
,
srcRoute
:
'/blog/[post]/[comment]'
},
'/blog/post.1'
:
{
dataRoute
:
`/_next/data/
${
buildId
}
/blog/post.1.json`
,
initialRevalidateSeconds
:
10
,
srcRoute
:
'/blog/[post]'
},
'/another'
:
{
dataRoute
:
`/_next/data/
${
buildId
}
/another.json`
,
initialRevalidateSeconds
:
0
,
...
...
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