You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #1319 Drop support of css-loader ^6, add support for css-loader ^7.1 (Kocal)
This PR was squashed before being merged into the main branch.
Discussion
----------
Drop support of css-loader ^6, add support for css-loader ^7.1
Let's continue to upgrade major dependencies, see https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#700-2024-04-04 for changelog
Commits
-------
ac0fd39 [CSS Modules] Update our React/Preact tests to fit css-loader v7 default options, notify Vue users about the new behaviour and the solution
8286aa1 Drop support of css-loader ^6, add support for css-loader ^7.1
*#1342 Replace [`assets-webpack-plugin`](https://github.com/ztoben/assets-webpack-plugin) dependency by an internal plugin, to generate `entrypoints.json` file (@Kocal)
93
93
94
+
*#1319 Drop support of css-loader ^6, add support for css-loader ^7.1 (@Kocal)
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
+
importstylefrom"./style.css";
101
+
102
+
console.log(style.myClass);
103
+
```
104
+
to:
105
+
```js
106
+
import*asstylefrom"./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.
0 commit comments