@@ -99,18 +99,16 @@ test('build w/ multi page', async () => {
9999 const assertSharedAssets = file => {
100100 // should split and preload vendor chunk
101101 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
108102 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 > / )
110103 }
111104
112105 const index = await project . read ( 'dist/index.html' )
113106 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 > / )
114112 // should preload correct page file
115113 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 > / )
116114 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 () => {
140138
141139 const bar = await project . read ( 'dist/bar.html' )
142140 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 > / )
143146 // should preload correct page file
144147 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 > / )
145148 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