Skip to content

postcss not working in webpack #276

Closed
@ir-fuel

Description

@ir-fuel

I am using webpack 3
This is my config

      {
        test: /\.css$/,
        exclude: /node_modules/,
        include: path.join(__dirname, 'client'),
        use: ['style-loader','css-loader',{
          loader:'postcss-loader',
          options: {
            config: {
                  path: path.join(__dirname, 'postcss.config.js')
                }
          }
        }]
      },

To make sure it actually picks up the config I put this in the postcss.config.js file

module.exports = {
  ]wepfowewepjwegpjo
  parser: 'sugarss',
  plugins: {
    'postcss-import': {},
    'postcss-cssnext': {},
    'autoprefixer': {},
    'postcss-focus': {},
    'postcss-nested': {},
    'postcss-url': {},
    'cssnano': {}
  }
}

This should never work as it isn't valid syntax.

The problem is it doesn't even throw an error when running webpack. The config file is located in the project root btw.

My css files are in client/css and when looking inside bundle.js I can see

exports.push([module.i, ":root {\n  --brand: #EB7C5C;\n  --text: #424242 ....

Which is the contents of my style.css file, so it does get picked up.

The styles are added to my index.jsx file as follows:

import './css/flexboxgrid.css'
import './css/font-awesome.css'
import './css/style.css'

Any idea what I am missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions