webpack-contrib / postcss-loader

PostCSS loader for webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature `Watch Config (postcss.config.js)` added in v1.2.2 was broken in v5.0.0

nolimitdev opened this issue · comments

Bug report

Feature Watch Config (postcss.config.js) added in v1.2.2 exactly here 0c8c07d was broken in v5.0.0 exactly here 21008cc by changing loaderContext.addDependency(result.filepath); to loaderContext.addBuildDependency(result.filepath);. It is hard to find specification for that methods addDependency() addBuildDependency() and other similar addMissingDependency() addContextDependency() addContextDependency() what is the difference. Since v5.0.0 (including latest v6.2.0) when I touch/modify postcss.config.js nothing happens. When I temporary change addBuildDependency() back to addDependency() in node_modules/postcss-loader/src/utils.js
recompiling works again.

Actual Behavior

Since v5.0.0 (including latest v6.2.0) when I touch/modify postcss.config.js nothing happens.

Expected Behavior

When I touch/modify postcss.config.js webpack should recompile.

How Do We Reproduce?

Touch/modify postcss.config.js

Please paste the results of npx webpack info here, and mention other relevant information

System:
OS: Windows
Binaries:
Node: 12.22.7
npm: 6.14.15
Packages:
babel-loader: 8.2.3 => 8.2.3
css-loader: 6.5.1 => 6.5.1
css-minimizer-webpack-plugin: 3.1.4 => 3.1.4
postcss-loader: 6.2.0 => 6.2.0
terser-webpack-plugin: 5.2.5 => 5.2.5
vue-loader: 16.8.3 => 16.8.3
vue-style-loader: 4.1.3 => 4.1.3
webpack: 5.64.2 => 5.64.2
webpack-build-notifier: 2.3.0 => 2.3.0
webpack-cli: 4.9.1 => 4.9.1
webpack-dev-server: 4.5.0 => 4.5.0

Please create reproducible test repo

Here you are
https://github.com/nolimitdev/postcss-loader-watch-config-bug

Ogininaly I thought it could be Windows OS based problem but I have tested this reproducible repo on debian with the same result - watch of config does not work. It is interesting that small change from addDependency() to addBuildDependency() caused this issue. It would be nice to get definitions for that two methods and what is the difference. Here https://webpack.js.org/api/loaders/ is just addDependency() and addBuildDependency() but other such as addBuildDependency() and addMissingDependency() are missing (maybe are considered private?). I was looking into source code of webpack but there are no useful comments.