Skip to content

Commit b641e1b

Browse files
committed
fix: make ssr-plugin compatible with wp4/5(vuejs#11718)
1 parent 4f81b5d commit b641e1b

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/server/webpack-plugin/client.js

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ export default class VueSSRClientPlugin {
1919
const initialFiles = uniq(Object.keys(stats.entrypoints)
2020
.map(name => stats.entrypoints[name].assets)
2121
.reduce((assets, all) => all.concat(assets), [])
22+
.map(function (file) {
23+
if (typeof file === "string") {
24+
return file;
25+
}
26+
27+
if (
28+
Object.prototype.toString.call(file) === "[object Object]" &&
29+
file.name
30+
) {
31+
return file.name;
32+
}
33+
34+
throw new Error(`file structure is not correct: ${file}`);
35+
})
2236
.filter((file) => isJS(file) || isCSS(file)))
2337

2438
const asyncFiles = allFiles

src/server/webpack-plugin/server.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,21 @@ export default class VueSSRServerPlugin {
2020
return cb()
2121
}
2222

23-
const entryAssets = entryInfo.assets.filter(isJS)
23+
const entryAssets = entryInfo.assets
24+
.map(function (file) {
25+
if (typeof file === "string") {
26+
return file;
27+
}
28+
29+
if (
30+
Object.prototype.toString.call(file) === "[object Object]" &&
31+
file.name
32+
) {
33+
return file.name;
34+
}
35+
36+
throw new Error(`file structure is not correct: ${file}`);
37+
}).filter(isJS)
2438

2539
if (entryAssets.length > 1) {
2640
throw new Error(

0 commit comments

Comments
 (0)