# Issues with Webpack 4 and PostCSS + Autoprefixer

**URL:** <https://forum.freecodecamp.org/t/issues-with-webpack-4-and-postcss-autoprefixer/213063>\
**Category:** General\
**Created:** [July 30, 2018, 5:20pm UTC](https://forum.freecodecamp.org/t/issues-with-webpack-4-and-postcss-autoprefixer/213063 "2018-07-30T17:20:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mewmew](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@mewmew](https://forum.freecodecamp.org/u/mewmew)\
**Post date:** [July 30, 2018, 5:20pm UTC](https://forum.freecodecamp.org/t/issues-with-webpack-4-and-postcss-autoprefixer/213063/1 "2018-07-30T17:20:42Z")

</div>

Let me start off by saying this is my first time using Webpack and cobbling together my own config, so there might be some obvious mistake I am overlooking.

**The Problem**

Right now, I am trying to use autoprefixer and even though I am not getting any errors, the prefixes are not appearing on my compiled CSS.

My test styles:

`styles/main.scss`:

```css
body {
  background-color: blue;
  display: flex;
  flex-direction: column;
  transition: all 300ms ease-in;
}

```

My `package.json` file:

```json
{
  "name": "react-webpack-boilerplate",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "NODE_ENV=development webpack-dev-server --mode development --open --hot",
    "build": "NODE_ENV=production webpack --mode production"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "prop-types": "^15.6.2",
    "react": "^16.4.1",
    "react-dom": "^16.4.1"
  },
  "devDependencies": {
    "autoprefixer": "^9.0.1",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "clean-webpack-plugin": "^0.1.19",
    "css-loader": "^1.0.0",
    "html-webpack-plugin": "^3.2.0",
    "mini-css-extract-plugin": "^0.4.1",
    "node-sass": "^4.9.2",
    "optimize-css-assets-webpack-plugin": "^5.0.0",
    "postcss-loader": "^2.1.6",
    "sass-loader": "^7.0.3",
    "style-loader": "^0.21.0",
    "webpack": "^4.16.3",
    "webpack-cli": "^3.1.0",
    "webpack-dev-server": "^3.1.5"
  }
}

```

My `postcss.config.js` file:

```javascript
module.exports = {
  plugins: [require('autoprefixer')]
};

```

My `webpack.config.js` file:

```javascript
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');

const inDevMode = process.env.NODE_ENV === 'development';
const port = process.env.PORT || 4200;

module.exports = {
  devtool: 'source-map',
  entry: './src/js/index.js',
  output: {
    filename: 'bundle.[hash].js',
    path: path.resolve(__dirname, 'dist')
  },
  devServer: {
    port
  },

  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        test: /\.js$/,
        exclude: /node_modules/,
        cache: true,
        sourceMap: true,
        uglifyOptions: {
          warnings: false,
          output: { comments: false }
        }
      }),
      new OptimizeCSSAssetsPlugin({})
    ]
  },
  plugins: [
    new CleanWebpackPlugin('./dist', {
      verbose: true,
      beforeEmit: true
    }),
    new HtmlWebpackPlugin({
      template: './src/index.html',
      title: 'Testing!'
    }),
    new MiniCssExtractPlugin({
      filename: '[name].[hash].css',
      chunkFilename: '[id].[hash].css'
    })
  ],
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader'
      },
      {
        test: /\.scss$/,
        use: [
          inDevMode ? 'style-loader' : MiniCssExtractPlugin.loader,
          { loader: 'css-loader', options: { sourceMap: true } },
          { loader: 'postcss-loader', options: { sourceMap: true } },
          { loader: 'sass-loader', options: { sourceMap: true } }
        ]
      }
    ]
  }
};

```

And my output CSS file when I’ve run my `build` script:

```css
body{background-color:#00f;color:#fff;display:flex;flex-direction:column;transition:all .3s ease-in}

```

I would really appreciate any help. This has had me stuck for hours. I can’t seem to find where I’m going wrong.

---

<div class="post-metadata">

**Author:** ![mewmew](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@mewmew](https://forum.freecodecamp.org/u/mewmew)\
**Post date:** [July 30, 2018, 5:31pm UTC](https://forum.freecodecamp.org/t/issues-with-webpack-4-and-postcss-autoprefixer/213063/2 "2018-07-30T17:31:45Z")

</div>

Well, I answered my own question and feel silly.

I didn’t realize that `flex` and `transition` properties were no longer being pre-fixed by Autofixer since they haven’t needed a prefix for the last few years in most browsers.

Adding a selector like `::selection { /* styles*/}` showed me that autoprefixer is indeed running.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 5:54pm UTC](https://forum.freecodecamp.org/t/issues-with-webpack-4-and-postcss-autoprefixer/213063/3 "2021-01-16T17:54:04Z")

</div>

Closed on January 16, 2021, 5:54pm UTC


