File tree Expand file tree Collapse file tree 5 files changed +1701
-1611
lines changed Expand file tree Collapse file tree 5 files changed +1701
-1611
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,21 @@ module.exports = {
22
22
getLoaders ( webpackConfig , useCssModules = false ) {
23
23
const usePostCssLoader = webpackConfig . usePostCssLoader ;
24
24
25
+ let modulesConfig = false ;
26
+ if ( useCssModules ) {
27
+ modulesConfig = {
28
+ localIdentName : '[local]_[hash:base64:5]' ,
29
+ } ;
30
+ }
31
+
25
32
const options = {
26
33
sourceMap : webpackConfig . useSourceMaps ,
27
34
// when using @import , how many loaders *before* css-loader should
28
35
// be applied to those imports? This defaults to 0. When postcss-loader
29
36
// is used, we set it to 1, so that postcss-loader is applied
30
37
// to @import resources.
31
38
importLoaders : usePostCssLoader ? 1 : 0 ,
32
- modules : useCssModules ,
33
- localIdentName : '[local]_[hash:base64:5]' ,
39
+ modules : modulesConfig
34
40
} ;
35
41
36
42
const cssLoaders = [
Original file line number Diff line number Diff line change 32
32
"babel-loader" : " ^8.0.0" ,
33
33
"chalk" : " ^2.4.1" ,
34
34
"clean-webpack-plugin" : " ^0.1.19" ,
35
- "css-loader" : " ^2.1.1 " ,
35
+ "css-loader" : " ^3.5.2 " ,
36
36
"fast-levenshtein" : " ^2.0.6" ,
37
37
"file-loader" : " ^1.1.10" ,
38
38
"friendly-errors-webpack-plugin" : " ^2.0.0-beta.1" ,
54
54
"yargs-parser" : " ^12.0.0"
55
55
},
56
56
"devDependencies" : {
57
- "@babel/plugin-transform-react-jsx" : " ^7.0.0" ,
58
57
"@babel/plugin-proposal-class-properties" : " ^7.0.0" ,
58
+ "@babel/plugin-transform-react-jsx" : " ^7.0.0" ,
59
59
"@babel/preset-react" : " ^7.0.0" ,
60
60
"@babel/preset-typescript" : " ^7.0.0" ,
61
61
"@vue/babel-helper-vue-jsx-merge-props" : " ^1.0.0-beta.3" ,
Original file line number Diff line number Diff line change @@ -1749,7 +1749,9 @@ module.exports = {
1749
1749
config . configureCssLoader ( options => {
1750
1750
// Remove hashes from local ident names
1751
1751
// since they are not always the same.
1752
- options . localIdentName = '[local]_foo' ;
1752
+ if ( options . modules ) {
1753
+ options . modules . localIdentName = '[local]_foo' ;
1754
+ }
1753
1755
} ) ;
1754
1756
1755
1757
// Enable the PostCSS loader so we can use `lang="postcss"`
@@ -2300,16 +2302,16 @@ module.exports = {
2300
2302
expect ( config . outputPath ) . to . be . a . directory ( )
2301
2303
. with . files ( [
2302
2304
'entrypoints.json' ,
2303
- 'runtime.d2591ff7 .js' ,
2304
- 'main.ceeddab6 .js' ,
2305
+ 'runtime.e9dea5e6 .js' ,
2306
+ 'main.00415522 .js' ,
2305
2307
'manifest.json' ,
2306
2308
'symfony_logo.ea1ca6f7.png' ,
2307
2309
'symfony_logo_alt.f27119c2.png' ,
2308
2310
] ) ;
2309
2311
2310
2312
webpackAssert . assertManifestPath (
2311
2313
'build/main.js' ,
2312
- '/build/main.ceeddab6 .js'
2314
+ '/build/main.00415522 .js'
2313
2315
) ;
2314
2316
}
2315
2317
Original file line number Diff line number Diff line change @@ -71,7 +71,9 @@ describe('loaders/css', () => {
71
71
expect ( actualLoaders ) . to . have . lengthOf ( 1 ) ;
72
72
expect ( actualLoaders [ 0 ] . options . foo ) . to . be . true ;
73
73
expect ( actualLoaders [ 0 ] . options . url ) . to . be . false ;
74
- expect ( actualLoaders [ 0 ] . options . modules ) . to . be . true ;
74
+ expect ( actualLoaders [ 0 ] . options . modules ) . to . deep . equals ( {
75
+ localIdentName : '[local]_[hash:base64:5]' ,
76
+ } ) ;
75
77
} ) ;
76
78
77
79
describe ( 'getLoaders() with PostCSS' , ( ) => {
You can’t perform that action at this time.
0 commit comments