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
5030486a
Unverified
Commit
5030486a
authored
Jul 16, 2019
by
Tim Neutkens
Committed by
GitHub
Jul 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t add loadable if it’s not used (#7995)
parent
4347fa4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
loadable.js
packages/next-server/lib/loadable.js
+5
-1
index.js
packages/next/client/index.js
+3
-2
No files found.
packages/next-server/lib/loadable.js
View file @
5030486a
...
@@ -296,7 +296,7 @@ Loadable.preloadAll = () => {
...
@@ -296,7 +296,7 @@ Loadable.preloadAll = () => {
})
})
}
}
Loadable
.
preloadReady
=
ids
=>
{
Loadable
.
preloadReady
=
(
ids
=
[])
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
const
res
=
()
=>
{
const
res
=
()
=>
{
initialized
=
true
initialized
=
true
...
@@ -307,4 +307,8 @@ Loadable.preloadReady = ids => {
...
@@ -307,4 +307,8 @@ Loadable.preloadReady = ids => {
})
})
}
}
if
(
typeof
window
!==
'undefined'
)
{
window
.
__NEXT_PRELOADREADY
=
Loadable
.
preloadReady
}
export
default
Loadable
export
default
Loadable
packages/next/client/index.js
View file @
5030486a
...
@@ -7,7 +7,6 @@ import mitt from 'next-server/dist/lib/mitt'
...
@@ -7,7 +7,6 @@ import mitt from 'next-server/dist/lib/mitt'
import
{
loadGetInitialProps
,
getURL
}
from
'next-server/dist/lib/utils'
import
{
loadGetInitialProps
,
getURL
}
from
'next-server/dist/lib/utils'
import
PageLoader
from
'./page-loader'
import
PageLoader
from
'./page-loader'
import
*
as
envConfig
from
'next-server/config'
import
*
as
envConfig
from
'next-server/config'
import
Loadable
from
'next-server/dist/lib/loadable'
import
{
HeadManagerContext
}
from
'next-server/dist/lib/head-manager-context'
import
{
HeadManagerContext
}
from
'next-server/dist/lib/head-manager-context'
import
{
DataManagerContext
}
from
'next-server/dist/lib/data-manager-context'
import
{
DataManagerContext
}
from
'next-server/dist/lib/data-manager-context'
import
{
RouterContext
}
from
'next-server/dist/lib/router-context'
import
{
RouterContext
}
from
'next-server/dist/lib/router-context'
...
@@ -155,7 +154,9 @@ export default async ({ webpackHMR: passedWebpackHMR } = {}) => {
...
@@ -155,7 +154,9 @@ export default async ({ webpackHMR: passedWebpackHMR } = {}) => {
initialErr
=
error
initialErr
=
error
}
}
await
Loadable
.
preloadReady
(
dynamicIds
||
[])
if
(
window
.
__NEXT_PRELOADREADY
)
{
await
window
.
__NEXT_PRELOADREADY
(
dynamicIds
)
}
if
(
dynamicBuildId
===
true
)
{
if
(
dynamicBuildId
===
true
)
{
pageLoader
.
onDynamicBuildId
()
pageLoader
.
onDynamicBuildId
()
...
...
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