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 96
96
"karma-webpack" : " ^2.0.1" ,
97
97
"lodash" : " ^4.17.1" ,
98
98
"lodash.template" : " ^4.4.0" ,
99
+ "lodash.uniq" : " ^4.5.0" ,
99
100
"lru-cache" : " ^4.0.2" ,
100
101
"nightwatch" : " ^0.9.9" ,
101
102
"nightwatch-helpers" : " ^1.2.0" ,
Original file line number Diff line number Diff line change 22
22
"hash-sum" : " ^1.0.2" ,
23
23
"he" : " ^1.1.0" ,
24
24
"lodash.template" : " ^4.4.0" ,
25
+ "lodash.uniq" : " ^4.5.0" ,
25
26
"resolve" : " ^1.2.0" ,
26
27
"source-map" : " 0.5.6" ,
27
28
"serialize-javascript" : " ^1.3.0"
Original file line number Diff line number Diff line change 1
1
const hash = require ( 'hash-sum' )
2
+ const uniq = require ( 'lodash.uniq' )
2
3
import { isJS } from './util'
3
4
4
5
export default class VueSSRClientPlugin {
@@ -12,13 +13,13 @@ export default class VueSSRClientPlugin {
12
13
compiler . plugin ( 'emit' , ( compilation , cb ) => {
13
14
const stats = compilation . getStats ( ) . toJson ( )
14
15
15
- const allFiles = stats . assets
16
- . map ( a => a . name )
16
+ const allFiles = uniq ( stats . assets
17
+ . map ( a => a . name ) )
17
18
18
- const initialFiles = Object . keys ( stats . entrypoints )
19
+ const initialFiles = uniq ( Object . keys ( stats . entrypoints )
19
20
. map ( name => stats . entrypoints [ name ] . assets )
20
21
. reduce ( ( assets , all ) => all . concat ( assets ) , [ ] )
21
- . filter ( isJS )
22
+ . filter ( isJS ) )
22
23
23
24
const asyncFiles = allFiles
24
25
. filter ( isJS )
@@ -39,6 +40,9 @@ export default class VueSSRClientPlugin {
39
40
if ( m . chunks . length === 1 ) {
40
41
const cid = m . chunks [ 0 ]
41
42
const chunk = stats . chunks . find ( c => c . id === cid )
43
+ if ( ! chunk || ! chunk . files ) {
44
+ return
45
+ }
42
46
const files = manifest . modules [ hash ( m . identifier ) ] = chunk . files . map ( fileToIndex )
43
47
// find all asset modules associated with the same chunk
44
48
assetModules . forEach ( m => {
You can’t perform that action at this time.
0 commit comments