Friday, 12 May 2017

Webpack postcss-loader not working when passed function

I am working on a webpack configuration in this repo. Right now when I run npm run teststart (which uses webpack.development.js) or npm run testbuild (which uses webpack.production.js), the postcss loader stylelint, autoprefixer and postcss-focus do not seem to work. However, if I pass an array instead of a function of the form () => [] to the plugins on the postcss-loader, it does work. So for example, if I change

options: {
  plugins: () => [require('autoprefixer'), require('postcss-focus')]
}

to

options: {
  plugins: [require('autoprefixer'), require('postcss-focus')]
}

in webpack.production.js it works.

But in another project the function format works fine. Trying to figure out why it isn't working here.



via jreed

No comments:

Post a Comment