File tree Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,38 @@ test('extract CSS', done => {
137
137
} )
138
138
} )
139
139
140
+ test ( 'extract CSS with code spliting' , done => {
141
+ bundle ( {
142
+ entry : 'extract-css-chunks.vue' ,
143
+ modify : config => {
144
+ config . module . rules = [
145
+ {
146
+ test : / \. v u e $ / ,
147
+ use : 'vue-loader'
148
+ } ,
149
+ {
150
+ test : / \. c s s $ / ,
151
+ use : [
152
+ MiniCssExtractPlugin . loader ,
153
+ 'css-loader'
154
+ ]
155
+ }
156
+ ]
157
+ } ,
158
+ plugins : [
159
+ new MiniCssExtractPlugin ( {
160
+ filename : 'test.output.css'
161
+ } )
162
+ ]
163
+ } , code => {
164
+ const css = normalizeNewline ( mfs . readFileSync ( '/test.output.css' ) . toString ( ) )
165
+ expect ( css ) . toContain ( `h1 {\n color: red;\n}` )
166
+ expect ( mfs . existsSync ( '/empty.test.output.css' ) ) . toBe ( false )
167
+ expect ( mfs . existsSync ( '/basic.test.output.css' ) ) . toBe ( true )
168
+ done ( )
169
+ } )
170
+ } )
171
+
140
172
test ( 'support rules with oneOf' , async ( ) => {
141
173
const run = ( entry , assert ) => new Promise ( ( resolve , reject ) => {
142
174
mockBundleAndRun ( {
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <h1 >empty style</h1 >
3
+ </template >
4
+
5
+ <style >
6
+ </style >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <basic ></basic >
4
+ <empty-style ></empty-style >
5
+ </div >
6
+ </template >
7
+
8
+ <script >
9
+ export default {
10
+ components: {
11
+ Basic : () => import (/* webpackChunkName: "basic" */ ' ./basic.vue' ),
12
+ EmptyStyle : () => import (/* webpackChunkName: "empty" */ ' ./empty-style.vue' )
13
+ }
14
+ }
15
+ </script >
16
+
17
+ <style >
18
+ h1 {
19
+ color : red ;
20
+ }
21
+ </style >
You can’t perform that action at this time.
0 commit comments