Skip to content

Commit

Permalink
build(dev-deps): Bump css-loader from 6.10.0 to 7.1.2 (#7668)
Browse files Browse the repository at this point in the history
- [x] Тест
  - [x] Сравнил `packages/vkui/dist/` в `master` и в `imirdzhamolov/issue6805/tech/css-loader-v7` – без изменений
  - [x] Локально проверил0 документации **Styleguide** и **Storybook** – стили не поехали

h2. Описание

С `v7.0.0` по умолчанию используется именованный экспорт CSS-модулей, поэтому отключил это поведение через опцию `namedExport: false` (см. подробнее в релиз ноуте https://github.com/webpack-contrib/css-loader/blob/v7.1.0/CHANGELOG.md). Расширил документацию `styleguide/pages/css_modules.md` на эту тему.

Также, для подстраховки, явно выставил `modules: false` там, где не нужны CSS-модули.

h2. Release notes

h2. Документация

- Раздел **CSS Modules** дополнен информацией про использование пакета с `'css-loader' >= 7.0.0`.
  • Loading branch information
inomdzhon authored Sep 27, 2024
1 parent 6eeb964 commit e99709d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions benchmark/runtime/webpack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const webpackConfig = {
{
test: /\.css$/i,
exclude: /node_modules/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
use: [MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { modules: false } }],
},
{
test: /\.module.css$/,
Expand All @@ -86,7 +86,7 @@ const webpackConfig = {
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: { importLoaders: 1 },
options: { modules: false, importLoaders: 1 },
},
{
loader: 'postcss-loader',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"autoprefixer": "^10.4.20",
"concurrently": "^9.0.1",
"cross-env": "^7.0.3",
"css-loader": "^6.10.0",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"cssnano": "^7.0.6",
"dotenv": "^16.4.5",
Expand Down
9 changes: 8 additions & 1 deletion styleguide/pages/css_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ module.exports = {
{
test: /\.css$/,
include: /node_modules\/@vkontakte\/vkui/,
use: ['css-loader'],
use: [{
loader: 'css-loader',
/* Используем следующие опции в случае использования `css-loader >= 7.0.0` (см. https://github.com/webpack-contrib/css-loader/blob/v7.1.0/CHANGELOG.md) */
// options: {
// namedExport: false,
// exportLocalsConvention: 'as-is',
// }
],
},
],
},
Expand Down
6 changes: 5 additions & 1 deletion webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const rules = [
exclude: sandbox ? new RegExp(`${sandbox}|\\.module\\.css$`) : /\.module\.css$/,
use: [
styleLoader,
'css-loader',
{ loader: 'css-loader', options: { modules: false } },
{
loader: 'postcss-loader',
options: {
Expand All @@ -69,6 +69,9 @@ const rules = [
loader: 'css-loader',
options: {
modules: {
// см. https://github.com/webpack-contrib/css-loader/blob/v7.1.0/CHANGELOG.md
namedExport: false,
exportLocalsConvention: 'as-is',
localIdentName: '[folder]__[local]--[hash:base64:5]',
},
},
Expand All @@ -94,6 +97,7 @@ if (sandbox) {
{
loader: 'css-loader',
options: {
modules: false,
importLoaders: 1,
},
},
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3783,7 +3783,7 @@ __metadata:
autoprefixer: "npm:^10.4.20"
concurrently: "npm:^9.0.1"
cross-env: "npm:^7.0.3"
css-loader: "npm:^6.10.0"
css-loader: "npm:^7.1.2"
css-minimizer-webpack-plugin: "npm:^7.0.0"
cssnano: "npm:^7.0.6"
dotenv: "npm:^16.4.5"
Expand Down

0 comments on commit e99709d

Please sign in to comment.