hjs-webpack does not honor the plugins option in postcss.config.js if present. This because
the postcss-loader is always given an options object with at least an empty array.
With the new Webpack 2 config syntax adding plugins or tweaking options involves
an ugly hack to delete the options object so the loader looks for the config file:
The plugins and their options defined in postcss.config.js are ignored.
To see the problem in effect, run npm run webpack, then npm run webpack:postcss
and see the differences in output in dist/main.css.
Proposed solution
Have hjs-webpack look for the presence of postcss.config.js and merge its
contents with whatever hjs-webpack is configured with, and have
postcss.config.js override any options that are defined in both places.
Explanation of the issue
hjs-webpack does not honor the
plugins
option inpostcss.config.js
if present. This because the postcss-loader is always given an options object with at least an empty array.With the new Webpack 2 config syntax adding plugins or tweaking options involves an ugly hack to delete the options object so the loader looks for the config file:
What are the consequences?
The plugins and their options defined in
postcss.config.js
are ignored.To see the problem in effect, run
npm run webpack
, thennpm run webpack:postcss
and see the differences in output indist/main.css
.Proposed solution
Have hjs-webpack look for the presence of
postcss.config.js
and merge its contents with whatever hjs-webpack is configured with, and havepostcss.config.js
override any options that are defined in both places.