It looks like you missed the postcss options. According to the documentation at https://github.com/postcss/postcss-loader , the following code should be placed at the top level of your configuration, and not in the module section:
postcss: function() { return [ autoprefixer ] }
Refresh.
In fact, for this integration of postcss and webpack, you need to write a lot more settings. Thanks to the following topic, I found a solution https://github.com/postcss/postcss-loader/issues/8
Firstly, for postcss to work with @import 'ed files, you must use the postcss-import plugin. To integrate this plugin with webpack (for example, enable file browsing for a hot reload or rebuild), a special parameter taken from the arguments to the initializer function is passed as the postcssImport argument as follows:
var autoprefixer = require('autoprefixer'); var postcssImport = require('postcss-import'); .... postcss: function(webpack) { return [ postcssImport({ addDependencyTo: webpack }),
Unfortunately, this disrupts asset loading via webpack when using url(...) with relative paths. This is because postcss-import merges all @import 'ed files into one, but the paths remain relative to the source directory files. To rewrite relative paths, use the postcss-url plugin, and now the configuration looks like this:
var autoprefixer = require('autoprefixer'); var postcssImport = require('postcss-import'); var postcssUrl = require('postcss-url'); .... postcss: function(webpack) { return [ postcssImport({ addDependencyTo: webpack }), postcssUrl(), autoprefixer ]; ]
source share