File tree Expand file tree Collapse file tree 5 files changed +48
-9
lines changed
preact-css-modules/components
react-css-modules/components Expand file tree Collapse file tree 5 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,37 @@ pnpm install webpack-dev-server --save-dev
9393
9494* #1319 Drop support of css-loader ^6, add support for css-loader ^7.1 (@Kocal )
9595
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+
96127## 4.7.0
97128
98129### Features
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ import './styles.css';
33import './styles.less' ;
44import './styles.scss' ;
55import './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' ;
1010
1111export default function App ( ) {
1212 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';
22import './styles.less' ;
33import './styles.scss' ;
44import './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' ;
99
1010export default function App ( ) {
1111 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' ;
22
33export default {
44 name : 'hello' ,
Original file line number Diff line number Diff line change @@ -1645,6 +1645,14 @@ module.exports = {
16451645 config . enableLessLoader ( ) ;
16461646 config . enableStylusLoader ( ) ;
16471647 config . configureCssLoader ( options => {
1648+ // Until https://github.com/vuejs/vue-loader/pull/1909 is merged,
1649+ // Vue users should configure the css-loader modules
1650+ // to keep the previous default behavior from css-loader v6
1651+ if ( options . modules ) {
1652+ options . modules . namedExport = false ;
1653+ options . modules . exportLocalsConvention = 'as-is' ;
1654+ }
1655+
16481656 // Remove hashes from local ident names
16491657 // since they are not always the same.
16501658 if ( options . modules ) {
You can’t perform that action at this time.
0 commit comments