Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postcss not working in webpack #276

Closed
ir-fuel opened this issue Jul 18, 2017 · 2 comments
Closed

postcss not working in webpack #276

ir-fuel opened this issue Jul 18, 2017 · 2 comments

Comments

@ir-fuel
Copy link

ir-fuel commented Jul 18, 2017

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?

@michael-ciniawsky
Copy link
Member

postcss-load-config #91 Tracking Issue (schema-validation). It should warn about incorrect config via postcss-load-config.

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Jul 18, 2017

The loader will fallback to { plugins: [], options: {} } and simply not run any PostCSS transforms then atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants