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 errors silently ignored #749

Closed
olivoil opened this issue Feb 5, 2018 · 4 comments
Closed

postcss errors silently ignored #749

olivoil opened this issue Feb 5, 2018 · 4 comments
Labels

Comments

@olivoil
Copy link

olivoil commented Feb 5, 2018

This is a 🙋 feature request I think.

🎛 Configuration (postcss.config.js)

// postcss.config.js

modules.export = function() {
   return {
      modules: true
   }
}

Parcel only works if postcss.config.js exports a direct object, not a function.

🤔 Expected Behavior

I think it would be helpful to the user, in case parcel does detect a postcss config, or any other supported transform config, to report errors back to the user, instead of silently ignoring them. Something along the line of Parcel detected configuration for postcss, but was not able to use it: <error with stack trace if available>.

😯 Current Behavior

Parcel does not give any error, and just bundles the css unprocessed.

💁 Possible Solution

The underlying problem is that parcel silently ignores the error and doesn't give useful feedback that would help understand what is happening. If a configuration for a particular transform is detected but fails to run, parcel should tell the developer that instead of ignoring it. I haven't looked into the source code of parcel yet, but happy to start a PR if you point me in the right direction.

🌍 Your Environment

Software Version(s)
Parcel 1.4.1
Node v8.9.4
Yarn v1.3.2
Operating System Linux Ubuntu 17.10
@olivoil
Copy link
Author

olivoil commented Feb 5, 2018

Looks like possibly #593 and #329 are related. It seems giving an informative error message would help them figure out why postcss isn't working

@DeMoorJasper
Copy link
Member

Doesn't seem like those issues you mentioned are very related but I opened a PR that validates it is an object

@hacknug
Copy link

hacknug commented Nov 27, 2018

@DeMoorJasper with v1.9.7 I was able to pass a function without any issues. What should I do now to enable/disable a PostCSS plugin based on the set NODE_ENV?

I've tried with process.env.NODE_ENV but then @fullhuman/postcss-purgecss complains about things. I've tried using a separate config file for it but then it complains about other stuff. Do you guys have an example on how to set this up?

I can post the exact errors I get and example config files if needed. Pretty sure it's my fault but since everything used to work fine on v1.9.7

@JounQin
Copy link

JounQin commented Sep 7, 2019

Why can not we support function PosctCSS config?

I have to call the function manually for now, which is ridiculous:

module.exports = require('@1stg/postcss-config')({ env: process.env.NODE_ENV })

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

No branches or pull requests

4 participants