@@ -99,18 +99,16 @@ test('build w/ multi page', async () => {
99
99
const assertSharedAssets = file => {
100
100
// should split and preload vendor chunk
101
101
expect ( file ) . toMatch ( / < l i n k [ ^ > ] * j s \/ c h u n k - v e n d o r s [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
102
- // should split and preload common js and css
103
- expect ( file ) . toMatch ( / < l i n k [ ^ > ] * j s \/ c h u n k - c o m m o n [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
104
- expect ( file ) . toMatch ( / < l i n k [ ^ > ] * c h u n k - c o m m o n [ ^ > ] * \. c s s r e l = p r e l o a d a s = s t y l e > / )
105
- // should load common css
106
- expect ( file ) . toMatch ( / < l i n k h r e f = \/ c s s \/ c h u n k - c o m m o n \. \w + \. c s s r e l = s t y l e s h e e t > / )
107
- // should load common js
108
102
expect ( file ) . toMatch ( / < s c r i p t [ ^ > ] * s r c = \/ j s \/ c h u n k - v e n d o r s \. \w + \. j s > / )
109
- expect ( file ) . toMatch ( / < s c r i p t [ ^ > ] * s r c = \/ j s \/ c h u n k - c o m m o n \. \w + \. j s > / )
110
103
}
111
104
112
105
const index = await project . read ( 'dist/index.html' )
113
106
assertSharedAssets ( index )
107
+ // should split and preload common js and css
108
+ expect ( index ) . toMatch ( / < l i n k [ ^ > ] * j s \/ c h u n k - c o m m o n [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
109
+ expect ( index ) . toMatch ( / < s c r i p t [ ^ > ] * s r c = \/ j s \/ c h u n k - c o m m o n \. \w + \. j s > / )
110
+ expect ( index ) . toMatch ( / < l i n k h r e f = \/ c s s \/ c h u n k - c o m m o n \. \w + \. c s s r e l = s t y l e s h e e t > / )
111
+ expect ( index ) . toMatch ( / < l i n k [ ^ > ] * c h u n k - c o m m o n [ ^ > ] * \. c s s r e l = p r e l o a d a s = s t y l e > / )
114
112
// should preload correct page file
115
113
expect ( index ) . toMatch ( / < l i n k [ ^ > ] * j s \/ i n d e x [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
116
114
expect ( index ) . not . toMatch ( / < l i n k [ ^ > ] * j s \/ f o o [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
@@ -140,6 +138,11 @@ test('build w/ multi page', async () => {
140
138
141
139
const bar = await project . read ( 'dist/bar.html' )
142
140
assertSharedAssets ( bar )
141
+ // bar & index have a shared common chunk (App.vue)
142
+ expect ( bar ) . toMatch ( / < l i n k [ ^ > ] * j s \/ c h u n k - c o m m o n [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
143
+ expect ( bar ) . toMatch ( / < s c r i p t [ ^ > ] * s r c = \/ j s \/ c h u n k - c o m m o n \. \w + \. j s > / )
144
+ expect ( bar ) . toMatch ( / < l i n k h r e f = \/ c s s \/ c h u n k - c o m m o n \. \w + \. c s s r e l = s t y l e s h e e t > / )
145
+ expect ( bar ) . toMatch ( / < l i n k [ ^ > ] * c h u n k - c o m m o n [ ^ > ] * \. c s s r e l = p r e l o a d a s = s t y l e > / )
143
146
// should preload correct page file
144
147
expect ( bar ) . not . toMatch ( / < l i n k [ ^ > ] * j s \/ i n d e x [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
145
148
expect ( bar ) . not . toMatch ( / < l i n k [ ^ > ] * j s \/ f o o [ ^ > ] * \. j s r e l = p r e l o a d a s = s c r i p t > / )
0 commit comments