Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Loading `@import`-ed CSS files breaks Webpack Hot Reloading

オープン
#700 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, webpack
領域
build-system

調査の方向性

リンクされている再現用リポジトリから始めます。yarn install と yarn run start を実行し、main.css と @import でインポートされる imported.css を使ってエラーリカバリーのシーケンスを再現します。imported.css の無効な編集を修正しても検出されない理由を追跡し、webpack を再起動せずにホットリロードで正常に再ビルドされれば Issue 完了とします。

索引モデルが issue の本文から書いたものです。

説明

Bug report
Actual Behavior

If you make an edit to an @import-ed CSS file that results in an error (e.g. invalid CSS), webpack hot reloader no longer detects further changes in that file - even if you correct or undo the edit (CTRL-Z). You need to restart webpack for it to start detecting the file again.

This is only in the specific scenario of a breaking change. Any valid change continues to be detected by hot reloading.

This is also specific to only @import-ed files. Any change to a top-level file that is not imported by another CSS file continues work with hot reloading.

Expected Behavior

Webpack Hot Reloader should continue detecting updates to the previously edited file. If the error is corrected, it should recompile and emit the successful file.

How Do We Reproduce?

Here is a repository to reproduce it: https://github.com/abhchand/webpack-postcss-hmr-issue-reproduction. This repo uses postcss to run Tailwind CSS.

  1. Clone the repo
  2. Run yarn install, then yarn run start
  3. Open http://localhost:3035/

You'll notice there are 2 CSS files - main.css and imported.css. The second one is @import-ed by the first.

You can reproduce the following scenarios:

action result
In main.css, make some breaking change (e.g. change tw:h-9 to tw-h-9) 🟢 Hot reloading should detect the change and present the error
In main.css, correct the above breaking change 🟢 Hot reloading should detect the change and rebuild the file
In imported.css, make some breaking change (e.g. change tw:border-green-500 to tw-border-green-500) 🟢 Hot reloading should detect the change and present the error
In imported.css, correct the above breaking change 🔴 Hot reloading does not detect the change and remains in error.

The only way to fix the last scenario is to restart webpack.

Please paste the results of npx webpack info here
$ npx webpack info

  System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    Memory: 7.60 GB / 15.36 GB
  Binaries:
    Node: 18.20.7 - ~/.nvm/versions/node/v18.20.7/bin/node
    Yarn: 1.22.22 - ~/.yarn/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v18.20.7/bin/npm
  Browsers:
    Chrome: 117.0.5938.132
  Packages:
    babel-loader: ^8.1.0 => 8.4.1
    css-loader: ^4.2.0 => 4.3.0
    html-webpack-plugin: ^5.5.0 => 5.6.3
    postcss-loader: ^7.0.1 => 7.3.4
    webpack: ^5.74.0 => 5.98.0
    webpack-cli: 4.10.0 => 4.10.0
    webpack-dev-server: ^4.11.1 => 4.15.2
主要言語
JavaScript
スター
2.8k
フォーク
211
平均マージ
51分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

webpack/postcss-loader のほかの issue

webpack/postcss-loader の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。