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
3edfe518
Unverified
Commit
3edfe518
authored
Apr 17, 2020
by
Joe Haddad
Committed by
GitHub
Apr 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strongly Type Usage of Client Pages Loader (#11985)
parent
0e915b11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
entries.ts
packages/next/build/entries.ts
+6
-2
on-demand-entry-handler.ts
packages/next/server/on-demand-entry-handler.ts
+6
-5
No files found.
packages/next/build/entries.ts
View file @
3edfe518
...
@@ -6,6 +6,7 @@ import { __ApiPreviewProps } from '../next-server/server/api-utils'
...
@@ -6,6 +6,7 @@ import { __ApiPreviewProps } from '../next-server/server/api-utils'
import
{
isTargetLikeServerless
}
from
'../next-server/server/config'
import
{
isTargetLikeServerless
}
from
'../next-server/server/config'
import
{
normalizePagePath
}
from
'../next-server/server/normalize-page-path'
import
{
normalizePagePath
}
from
'../next-server/server/normalize-page-path'
import
{
warn
}
from
'./output/log'
import
{
warn
}
from
'./output/log'
import
{
ClientPagesLoaderOptions
}
from
'./webpack/loaders/next-client-pages-loader'
import
{
ServerlessLoaderQuery
}
from
'./webpack/loaders/next-serverless-loader'
import
{
ServerlessLoaderQuery
}
from
'./webpack/loaders/next-serverless-loader'
type
PagesMapping
=
{
type
PagesMapping
=
{
...
@@ -128,10 +129,13 @@ export function createEntrypoints(
...
@@ -128,10 +129,13 @@ export function createEntrypoints(
}
}
if
(
!
isApiRoute
)
{
if
(
!
isApiRoute
)
{
const
pageLoader
=
`next-client-pages-loader?
${
stringify
(
{
const
pageLoader
Opts
:
ClientPagesLoaderOptions
=
{
page
,
page
,
absolutePagePath
,
absolutePagePath
,
})}
!`
}
const
pageLoader
=
`next-client-pages-loader?
${
stringify
(
pageLoaderOpts
)}
!`
// Make sure next/router is a dependency of _app or else granularChunks
// Make sure next/router is a dependency of _app or else granularChunks
// might cause the router to not be able to load causing hydration
// might cause the router to not be able to load causing hydration
...
...
packages/next/server/on-demand-entry-handler.ts
View file @
3edfe518
...
@@ -6,9 +6,9 @@ import { parse } from 'url'
...
@@ -6,9 +6,9 @@ import { parse } from 'url'
import
webpack
from
'webpack'
import
webpack
from
'webpack'
import
WebpackDevMiddleware
from
'webpack-dev-middleware'
import
WebpackDevMiddleware
from
'webpack-dev-middleware'
import
DynamicEntryPlugin
from
'webpack/lib/DynamicEntryPlugin'
import
DynamicEntryPlugin
from
'webpack/lib/DynamicEntryPlugin'
import
{
isWriteable
}
from
'../build/is-writeable'
import
{
isWriteable
}
from
'../build/is-writeable'
import
*
as
Log
from
'../build/output/log'
import
*
as
Log
from
'../build/output/log'
import
{
ClientPagesLoaderOptions
}
from
'../build/webpack/loaders/next-client-pages-loader'
import
{
API_ROUTE
}
from
'../lib/constants'
import
{
API_ROUTE
}
from
'../lib/constants'
import
{
import
{
IS_BUNDLED_PAGE_REGEX
,
IS_BUNDLED_PAGE_REGEX
,
...
@@ -85,12 +85,13 @@ export default function onDemandEntryHandler(
...
@@ -85,12 +85,13 @@ export default function onDemandEntryHandler(
}
}
entries
[
page
].
status
=
BUILDING
entries
[
page
].
status
=
BUILDING
const
pageLoaderOpts
:
ClientPagesLoaderOptions
=
{
page
,
absolutePagePath
,
}
return
addEntry
(
compilation
,
compiler
.
context
,
name
,
[
return
addEntry
(
compilation
,
compiler
.
context
,
name
,
[
compiler
.
name
===
'client'
compiler
.
name
===
'client'
?
`next-client-pages-loader?
${
stringify
({
?
`next-client-pages-loader?
${
stringify
(
pageLoaderOpts
)}
!`
page
,
absolutePagePath
,
})}
!`
:
absolutePagePath
,
:
absolutePagePath
,
])
])
})
})
...
...
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