@@ -180,20 +180,8 @@ module.exports = {
180
180
compact : true ,
181
181
} ,
182
182
} ,
183
- // The notation here is somewhat confusing.
184
- // "postcss" loader applies autoprefixer to our CSS.
185
- // "css" loader resolves paths in CSS and adds assets as dependencies.
186
- // "style" loader normally turns CSS into JS modules injecting <style>,
187
- // but unlike in development configuration, we do something different.
188
- // `ExtractTextPlugin` first applies the "postcss" and "css" loaders
189
- // (second argument), then grabs the result CSS and puts it into a
190
- // separate file in our build process. This way we actually ship
191
- // a single CSS file in production instead of JS code injecting <style>
192
- // tags. If you use code splitting, however, any async bundles will still
193
- // use the "style" loader inside the async code so CSS from them won't be
194
- // in the main CSS file.
195
183
{
196
- test : / \. c s s $ / ,
184
+ test : / \. m o d u l e \. c s s $ / ,
197
185
loader : ExtractTextPlugin . extract (
198
186
Object . assign (
199
187
{
@@ -202,9 +190,11 @@ module.exports = {
202
190
{
203
191
loader : require . resolve ( 'css-loader' ) ,
204
192
options : {
193
+ modules : true ,
205
194
importLoaders : 1 ,
206
195
minimize : true ,
207
196
sourceMap : shouldUseSourceMap ,
197
+ localIdentName : '[name]__[local]__[hash:base64:5]'
208
198
} ,
209
199
} ,
210
200
{
@@ -235,7 +225,7 @@ module.exports = {
235
225
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
236
226
} ,
237
227
{
238
- test : / \. m o d u l e \. c s s $ / ,
228
+ test : / \. m o d u l e \. s [ c a ] s s $ / ,
239
229
loader : ExtractTextPlugin . extract (
240
230
Object . assign (
241
231
{
@@ -271,15 +261,83 @@ module.exports = {
271
261
] ,
272
262
} ,
273
263
} ,
264
+ { loader : 'sass-loader' , options : { sourceMap : shouldUseSourceMap } }
274
265
] ,
275
266
} ,
276
267
extractTextPluginOptions
277
268
)
278
269
) ,
279
270
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
280
271
} ,
272
+ // The notation here is somewhat confusing.
273
+ // "postcss" loader applies autoprefixer to our CSS.
274
+ // "css" loader resolves paths in CSS and adds assets as dependencies.
275
+ // "style" loader normally turns CSS into JS modules injecting <style>,
276
+ // but unlike in development configuration, we do something different.
277
+ // `ExtractTextPlugin` first applies the "postcss" and "css" loaders
278
+ // (second argument), then grabs the result CSS and puts it into a
279
+ // separate file in our build process. This way we actually ship
280
+ // a single CSS file in production instead of JS code injecting <style>
281
+ // tags. If you use code splitting, however, any async bundles will still
282
+ // use the "style" loader inside the async code so CSS from them won't be
283
+ // in the main CSS file.
281
284
{
282
- test : / \. m o d u l e \. s [ c a ] s s $ / ,
285
+ test : / \. c s s $ / ,
286
+ loader : ExtractTextPlugin . extract (
287
+ Object . assign (
288
+ {
289
+ fallback : require . resolve ( 'style-loader' ) ,
290
+ use : [
291
+ {
292
+ loader : require . resolve ( 'css-loader' ) ,
293
+ options : {
294
+ importLoaders : 1 ,
295
+ minimize : true ,
296
+ sourceMap : shouldUseSourceMap ,
297
+ } ,
298
+ } ,
299
+ {
300
+ loader : require . resolve ( 'postcss-loader' ) ,
301
+ options : {
302
+ // Necessary for external CSS imports to work
303
+ // https://github.com/facebookincubator/create-react-app/issues/2677
304
+ ident : 'postcss' ,
305
+ plugins : ( ) => [
306
+ require ( 'postcss-flexbugs-fixes' ) ,
307
+ autoprefixer ( {
308
+ browsers : [
309
+ '>1%' ,
310
+ 'last 4 versions' ,
311
+ 'Firefox ESR' ,
312
+ 'not ie < 9' , // React doesn't support IE8 anyway
313
+ ] ,
314
+ flexbox : 'no-2009' ,
315
+ } ) ,
316
+ ] ,
317
+ } ,
318
+ } ,
319
+ ] ,
320
+ } ,
321
+ extractTextPluginOptions
322
+ )
323
+ ) ,
324
+ // Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
325
+ } ,
326
+ // The notation here is somewhat confusing.
327
+ // "sass-loader" converts sass/scss files to CSS output
328
+ // "postcss" loader applies autoprefixer to our CSS.
329
+ // "css" loader resolves paths in CSS and adds assets as dependencies.
330
+ // "style" loader normally turns CSS into JS modules injecting <style>,
331
+ // but unlike in development configuration, we do something different.
332
+ // `ExtractTextPlugin` first applies the "postcss" and "css" loaders
333
+ // (second argument), then grabs the result CSS and puts it into a
334
+ // separate file in our build process. This way we actually ship
335
+ // a single CSS file in production instead of JS code injecting <style>
336
+ // tags. If you use code splitting, however, any async bundles will still
337
+ // use the "style" loader inside the async code so CSS from them won't be
338
+ // in the main CSS file.
339
+ {
340
+ test : / \. c s s $ / ,
283
341
loader : ExtractTextPlugin . extract (
284
342
Object . assign (
285
343
{
@@ -288,11 +346,9 @@ module.exports = {
288
346
{
289
347
loader : require . resolve ( 'css-loader' ) ,
290
348
options : {
291
- modules : true ,
292
349
importLoaders : 1 ,
293
350
minimize : true ,
294
351
sourceMap : shouldUseSourceMap ,
295
- localIdentName : '[name]__[local]__[hash:base64:5]'
296
352
} ,
297
353
} ,
298
354
{
0 commit comments