Skip to content

Commit

Permalink
refactor(bundler-webpack): make use of flatMap
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed May 22, 2024
1 parent abe7bf9 commit 3aed731
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/bundler-webpack/src/build/ssr/createClientPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ export const createClientPlugin = (
const allFiles = assets.map((a) => a.name)

// get initial entry files
const initialFiles =
Object.keys(entrypoints)
.map(
(name) =>
entrypoints[name].assets?.map((item) => item.name) ?? [],
)
.reduce((assets, all) => all.concat(assets), [])
.filter((file) => isJS(file) || isCSS(file)) ?? []
const initialFiles = Object.keys(entrypoints)
.flatMap(
(name) =>
entrypoints[name].assets?.map((item) => item.name) ?? [],
)
.filter((file) => isJS(file) || isCSS(file))

// get files that should be loaded asynchronously
// i.e. script and style files that are not included in the initial entry files
Expand Down

0 comments on commit 3aed731

Please sign in to comment.