File tree 5 files changed +49
-9
lines changed
preact-css-modules/components
react-css-modules/components
5 files changed +49
-9
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,37 @@ pnpm install webpack-dev-server --save-dev
93
93
94
94
* #1319 Drop support of css-loader ^6, add support for css-loader ^7.1 (@Kocal )
95
95
96
+ Since [ ` css-loader ` 7.0.0] ( https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#700-2024-04-04 ) ,
97
+ styles imports became named by default.
98
+ It means you should update your code from:
99
+ ``` js
100
+ import style from " ./style.css" ;
101
+
102
+ console .log (style .myClass );
103
+ ```
104
+ to:
105
+ ``` js
106
+ import * as style from " ./style.css" ;
107
+
108
+ console .log (style .myClass );
109
+ ```
110
+
111
+ There is also a possibility to keep the previous behavior by configuring the ` css-loader ` 's ` modules ` option:
112
+ ``` js
113
+ config .configureCssLoader (options => {
114
+ if (options .modules ) {
115
+ options .modules .namedExport = false ;
116
+ options .modules .exportLocalsConvention = ' as-is' ;
117
+ }
118
+ });
119
+ ```
120
+
121
+ > [ !IMPORTANT]
122
+ > If you use CSS Modules inside ` .vue ` files,
123
+ > until https://github.com/vuejs/vue-loader/pull/1909 is merged and released, you will need to restore the previous
124
+ > behavior by configuring Encore with the code above.
125
+
126
+
96
127
## 4.7.0
97
128
98
129
### Features
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ import './styles.css';
3
3
import './styles.less' ;
4
4
import './styles.scss' ;
5
5
import './styles.stylus' ;
6
- import stylesCss from './styles.module.css?module' ;
7
- import stylesLess from './styles.module.less?module' ;
8
- import stylesScss from './styles.module.scss?module' ;
9
- import stylesStylus from './styles.module.stylus?module' ;
6
+ import * as stylesCss from './styles.module.css?module' ;
7
+ import * as stylesLess from './styles.module.less?module' ;
8
+ import * as stylesScss from './styles.module.scss?module' ;
9
+ import * as stylesStylus from './styles.module.stylus?module' ;
10
10
11
11
export default function App ( ) {
12
12
return < div className = { `red large justified lowercase ${ stylesCss . italic } ${ stylesLess . underline } ${ stylesScss . bold } ${ stylesStylus . rtl } ` } > </ div >
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ import './styles.css';
2
2
import './styles.less' ;
3
3
import './styles.scss' ;
4
4
import './styles.stylus' ;
5
- import stylesCss from './styles.module.css?module' ;
6
- import stylesLess from './styles.module.less?module' ;
7
- import stylesScss from './styles.module.scss?module' ;
8
- import stylesStylus from './styles.module.stylus?module' ;
5
+ import * as stylesCss from './styles.module.css?module' ;
6
+ import * as stylesLess from './styles.module.less?module' ;
7
+ import * as stylesScss from './styles.module.scss?module' ;
8
+ import * as stylesStylus from './styles.module.stylus?module' ;
9
9
10
10
export default function App ( ) {
11
11
return < div className = { `red large justified lowercase ${ stylesCss . italic } ${ stylesLess . underline } ${ stylesScss . bold } ${ stylesStylus . rtl } ` } > </ div >
Original file line number Diff line number Diff line change 1
- import styles from './Hello.css?module' ;
1
+ import * as styles from './Hello.css?module' ;
2
2
3
3
export default {
4
4
name : 'hello' ,
Original file line number Diff line number Diff line change @@ -1641,6 +1641,15 @@ module.exports = {
1641
1641
config . setPublicPath ( '/build' ) ;
1642
1642
config . addEntry ( 'main' , `./vuejs-css-modules/main_v${ getVueVersion ( config ) } ` ) ;
1643
1643
config . enableVueLoader ( ) ;
1644
+ config . configureCssLoader ( options => {
1645
+ // Until https://github.com/vuejs/vue-loader/pull/1909 is merged,
1646
+ // Vue users should configure the css-loader modules
1647
+ // to keep the previous default behavior from css-loader v6
1648
+ if ( options . modules ) {
1649
+ options . modules . namedExport = false ;
1650
+ options . modules . exportLocalsConvention = 'as-is' ;
1651
+ }
1652
+ } )
1644
1653
config . enableSassLoader ( ) ;
1645
1654
config . enableLessLoader ( ) ;
1646
1655
config . enableStylusLoader ( ) ;
You can’t perform that action at this time.
0 commit comments