Parcel: Parcel fails with postcss error after some changes happen in the css file

Created on 21 Feb 2018  路  6Comments  路  Source: parcel-bundler/parcel

馃悰
I use css-modules in my project and it suddenly starts to throw an error when I do some changes in the css files (for js changes all works fine)

Server running at http://localhost:1234 馃毃 /Users/yiooxir/projects/test/react-parcel-example/index.css:undefined:undefined: Cannot read property 'postcss' of null at Processor.normalize (/Users/yiooxir/projects/test/react-parcel-example/node_modules/parcel-bundler/node_modules/postcss/lib/processor.js:136:12)

I found out that when the css modules is off postcss: modules: false all work as expected.

It also can be reproduced on the react-parcel-example if you switch in the package.json postcss: modules to true.

馃帥 Configuration (.babelrc, package.json, cli command)

// .babelrc
{
  "presets": ["react-app"]
}

馃槸 Current Behavior

Rebundle process stops with error:
Server running at http://localhost:1234 馃毃 /Users/yiooxir/projects/test/react-parcel-example/index.css:undefined:undefined: Cannot read property 'postcss' of null at Processor.normalize (/Users/yiooxir/projects/test/react-parcel-example/node_modules/parcel-bundler/node_modules/postcss/lib/processor.js:136:12) at new Processor (/Users/yiooxir/projects/test/react-parcel-example/node_modules/parcel-bundler/node_modules/postcss/lib/processor.js:51:25) at postcss (/Users/yiooxir/projects/test/react-parcel-example/node_modules/parcel-bundler/node_modules/postcss/lib/postcss.js:73:10) at module.exports (/Users/yiooxir/projects/test/react-parcel-example/node_modules/parcel-bundler/src/transforms/postcss.js:13:19) at <anonymous>

馃敠 Context

Application bundled successfully at first time and error is appearing when we make changes in any css file only.

馃捇 Code Sample

can be reproduced on react-parcel-example

馃實 Your Environment

installed packages list can be found on react-parcel-example

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.6.0
| Node | 8.4.0
| Yarn | 1.0.2
| Operating System | mac os

Bug CSS Preprocessing

Most helpful comment

Hi @meowgorithm,

Not sure if this will help you but I got the same error when trying to configure postcss inside of my package.json file.

The error disappeared when I switched to using the .postcssrc config file.

I'm using [email protected].

All 6 comments

+1. I鈥檓 fairly sure this issue arose for me after I upgraded to from Parcel 1.5.1 to Parcel 1.6.2.

鈥ope. rolled back to 1.5.1 and the issue remained, at least for me.

Hi @meowgorithm,

Not sure if this will help you but I got the same error when trying to configure postcss inside of my package.json file.

The error disappeared when I switched to using the .postcssrc config file.

I'm using [email protected].

@matthewlynch Thanks, Matt! I did exactly that and now things are working as they should (as of [email protected]).

Thanks, @meowgorithm !! It looks like it solved my problem too!

Maybe somebody encountered such a problem when you make a change in css file - parcel rebuilds only css, so appropriate class in the html lost their relative css rules becouse css hash changed only in css ?

Was this page helpful?
0 / 5 - 0 ratings