File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
packages/vue-server-renderer
src/server/webpack-plugin Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 9696 "karma-webpack" : " ^2.0.1" ,
9797 "lodash" : " ^4.17.1" ,
9898 "lodash.template" : " ^4.4.0" ,
99+ "lodash.uniq" : " ^4.5.0" ,
99100 "lru-cache" : " ^4.0.2" ,
100101 "nightwatch" : " ^0.9.9" ,
101102 "nightwatch-helpers" : " ^1.2.0" ,
Original file line number Diff line number Diff line change 2222 "hash-sum" : " ^1.0.2" ,
2323 "he" : " ^1.1.0" ,
2424 "lodash.template" : " ^4.4.0" ,
25+ "lodash.uniq" : " ^4.5.0" ,
2526 "resolve" : " ^1.2.0" ,
2627 "source-map" : " 0.5.6" ,
2728 "serialize-javascript" : " ^1.3.0"
Original file line number Diff line number Diff line change 11const hash = require ( 'hash-sum' )
2+ const uniq = require ( 'lodash.uniq' )
23import { isJS } from './util'
34
45export default class VueSSRClientPlugin {
@@ -12,13 +13,13 @@ export default class VueSSRClientPlugin {
1213 compiler . plugin ( 'emit' , ( compilation , cb ) => {
1314 const stats = compilation . getStats ( ) . toJson ( )
1415
15- const allFiles = stats . assets
16- . map ( a => a . name )
16+ const allFiles = uniq ( stats . assets
17+ . map ( a => a . name ) )
1718
18- const initialFiles = Object . keys ( stats . entrypoints )
19+ const initialFiles = uniq ( Object . keys ( stats . entrypoints )
1920 . map ( name => stats . entrypoints [ name ] . assets )
2021 . reduce ( ( assets , all ) => all . concat ( assets ) , [ ] )
21- . filter ( isJS )
22+ . filter ( isJS ) )
2223
2324 const asyncFiles = allFiles
2425 . filter ( isJS )
@@ -39,6 +40,9 @@ export default class VueSSRClientPlugin {
3940 if ( m . chunks . length === 1 ) {
4041 const cid = m . chunks [ 0 ]
4142 const chunk = stats . chunks . find ( c => c . id === cid )
43+ if ( ! chunk || ! chunk . files ) {
44+ return
45+ }
4246 const files = manifest . modules [ hash ( m . identifier ) ] = chunk . files . map ( fileToIndex )
4347 // find all asset modules associated with the same chunk
4448 assetModules . forEach ( m => {
You can’t perform that action at this time.
0 commit comments