Skip to content

Commit 3aed731

Browse files
committed
refactor(bundler-webpack): make use of flatMap
1 parent abe7bf9 commit 3aed731

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/bundler-webpack/src/build/ssr/createClientPlugin.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ export const createClientPlugin = (
3434
const allFiles = assets.map((a) => a.name)
3535

3636
// get initial entry files
37-
const initialFiles =
38-
Object.keys(entrypoints)
39-
.map(
40-
(name) =>
41-
entrypoints[name].assets?.map((item) => item.name) ?? [],
42-
)
43-
.reduce((assets, all) => all.concat(assets), [])
44-
.filter((file) => isJS(file) || isCSS(file)) ?? []
37+
const initialFiles = Object.keys(entrypoints)
38+
.flatMap(
39+
(name) =>
40+
entrypoints[name].assets?.map((item) => item.name) ?? [],
41+
)
42+
.filter((file) => isJS(file) || isCSS(file))
4543

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

0 commit comments

Comments
 (0)