supasympa
4/26/2017 - 7:49 PM

Minimal Webpack / PostCss config to get post CSS up and running

Minimal Webpack / PostCss config to get post CSS up and running

const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')

const webpackConfig = {
  devtool: 'source-map',
  entry: './src/index.js',

  output: {
    path: path.resolve(__dirname, './build'),
    filename: 'index.bundle.js'
  },

  module: {
    rules: [
      {
        test: /\.css/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            'css-loader?sourceMap',
            'postcss-loader'
          ]
        })

      }
    ]
  },
  plugins: [
    new ExtractTextPlugin('styles.css')
  ]

}

module.exports = webpackConfig