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
41c9fe4f
Unverified
Commit
41c9fe4f
authored
Aug 25, 2024
by
Shu Ding
Committed by
GitHub
Aug 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor unused import and object in Flight plugin (#69266)
Only the `modules` field of `loaderOptions` is used.
parent
bc5bba89
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
flight-client-entry-plugin.ts
...t/src/build/webpack/plugins/flight-client-entry-plugin.ts
+9
-16
No files found.
packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts
View file @
41c9fe4f
import
type
{
import
type
{
CssImports
,
CssImports
,
ClientComponentImports
,
ClientComponentImports
,
FlightClientEntryModuleItem
,
}
from
'../loaders/next-flight-client-entry-loader'
}
from
'../loaders/next-flight-client-entry-loader'
import
{
webpack
}
from
'next/dist/compiled/webpack/webpack'
import
{
webpack
}
from
'next/dist/compiled/webpack/webpack'
...
@@ -841,38 +840,32 @@ export class FlightClientEntryPlugin {
...
@@ -841,38 +840,32 @@ export class FlightClientEntryPlugin {
]
{
]
{
let
shouldInvalidate
=
false
let
shouldInvalidate
=
false
const
loaderOptions
:
{
const
modules
=
Object
.
keys
(
clientImports
)
modules
:
FlightClientEntryModuleItem
[]
server
:
boolean
}
=
{
modules
:
Object
.
keys
(
clientImports
)
.
sort
((
a
,
b
)
=>
(
regexCSS
.
test
(
b
)
?
1
:
a
.
localeCompare
(
b
)))
.
sort
((
a
,
b
)
=>
(
regexCSS
.
test
(
b
)
?
1
:
a
.
localeCompare
(
b
)))
.
map
((
clientImportPath
)
=>
({
.
map
((
clientImportPath
)
=>
({
request
:
clientImportPath
,
request
:
clientImportPath
,
ids
:
[...
clientImports
[
clientImportPath
]],
ids
:
[...
clientImports
[
clientImportPath
]],
})),
}))
server
:
false
,
}
// For the client entry, we always use the CJS build of Next.js. If the
// For the client entry, we always use the CJS build of Next.js. If the
// server is using the ESM build (when using the Edge runtime), we need to
// server is using the ESM build (when using the Edge runtime), we need to
// replace them.
// replace them.
const
clientBrowserLoader
=
`next-flight-client-entry-loader?
${
stringify
({
const
clientBrowserLoader
=
`next-flight-client-entry-loader?
${
stringify
({
modules
:
(
this
.
isEdgeServer
modules
:
(
this
.
isEdgeServer
?
loaderOptions
.
modules
.
map
(({
request
,
ids
})
=>
({
?
modules
.
map
(({
request
,
ids
})
=>
({
request
:
request
.
replace
(
request
:
request
.
replace
(
/
[\\/]
next
[\\/]
dist
[\\/]
esm
[\\/]
/
,
/
[\\/]
next
[\\/]
dist
[\\/]
esm
[\\/]
/
,
'/next/dist/'
.
replace
(
/
\/
/g
,
path
.
sep
)
'/next/dist/'
.
replace
(
/
\/
/g
,
path
.
sep
)
),
),
ids
,
ids
,
}))
}))
:
loaderOptions
.
modules
:
modules
).
map
((
x
)
=>
JSON
.
stringify
(
x
)),
).
map
((
x
)
=>
JSON
.
stringify
(
x
)),
server
:
false
,
server
:
false
,
})}
!`
})}
!`
const
clientSSRLoader
=
`next-flight-client-entry-loader?
${
stringify
({
const
clientSSRLoader
=
`next-flight-client-entry-loader?
${
stringify
({
modules
:
loaderOptions
.
modules
.
map
((
x
)
=>
JSON
.
stringify
(
x
)),
modules
:
modules
.
map
((
x
)
=>
JSON
.
stringify
(
x
)),
server
:
true
,
server
:
true
,
})}
!`
})}
!`
...
...
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