-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 with config file, but with postcss key in package.json only #2120
Comments
my parcel version is |
@KirinHuang I have tried that too, but it's not working for me |
Any luck on this? I have a similar setup and having the same problem. :/ |
@didimedina I don't think anybody's coming up with solutions :( |
Just came across the same problem. Apparently autoprefixer is only run when a browserslist config is available, because when I placed a That would also explain why things worked for @9oelM when he added a |
Since 2017 parcel is unable to handle css modules properly, such a shame. I'm thinking about moving to webpack again 🤔 |
@lvkins no reason not to. Sorry for parcel, but I already have moved. |
I'm getting that same issue, but even adding a postcss key in package.json doesn't work either using these versions:
Found older versions worked fine:
Using only
Is there any fix to this in Parcel 2? |
I run into the same issue with the latest Parcel version. Using the |
I had this problem and switching to |
Edit: Working fine now with |
@0xbkt which parcel version? Does it work with |
Getting similar problem now. I'm using nightly build because that's PostCSS's official suggestion to integrate with PostCSS 8 and make the latest Originally I use module.exports = {
plugins: [
require('autoprefixer'),
require('postcss-flexbugs-fixes')
]
} (Another question: I'm not sure if we still need to add It still works in v2, but you'll always get message for not using JSON config format. So I tried using this JSON to replace the original config: {
"modules": true,
"plugins": {
"postcss-modules": {},
"autoprefixer": {},
"postcss-flexbugs-fixes": {}
}
} There was no warning or error message appear during the bundling process. However, the output didn't work and I got this kind of error message in Chrome browser:
Did I miss any required modules, or have some mistake in the config file? |
This works for me: <script src="index.js"></script> import * as styles from "./index.css";
console.log(styles); .a {
color: red;
} .postcssrc:
|
I had the same issue as @pykenny where it would tell me something along the lines of |
Please open a new issue with a complete code sample |
No issue anymore, just thought it might help someone in this thread. Also here's a link to a working public repo https://github.com/simerlec/react-starter |
I agree this is a problem for me as well still. I just installed parcel@next and I can only get the process to work using the postcss key in package.json. |
Oh, actually, I can only get it to work when I use the key in package.json, or when I use |
I was pulling my hair out for a while. I really wanted to use tailwindcss with parcel but I just couldn't edit the postcss config file. It really is working fine now because of the json only workaround. It just comes down to not being able to use a javascript config file for some reason, only json will work. It failed running a javascript config on both the latest version of parcel 1 and also on 2.0.0-beta.2. |
Nothing above helps. |
A build only works if I remove |
Since in here are some of the dependencies in my package.json
here is my .postcssrc {
"modules": false,
"plugins": {
"autoprefixer": {
"grid": "autoplace",
"flexbox": true,
"cascade": false,
"remove": false
}
}
} So. Now the presence of my .postcssrc file does not cause an error during assembly, and after assembly my React application starts without giving an error stating that the module was not found. |
@Andrew-Dyachenko It requires more than just one package to be an old version? |
Basically I used |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
🐛 bug report
Parcel says you can provide postcss configs using .postcssrc (JSON), .postcssrc.js, or postcss.config.js.. But this does not just work! Parcel misses out on this file for some reason.
🎛 Configuration (.babelrc, package.json, cli command)
So here's my project using parcel, and this is the tree structure:
And this is
postcss.config.js
(I tried.postcssrc
and.postcssrc.js
as well, supposing the name might might might.. be a problem but it wasn't)And
package.json
:🤔 Expected Behavior && Current Behavior
So expectedly, according to what parcel says, it's gotta process css codes to transform them. But it just doesn't.
Here's what I did to test this:
autoprefixer
andpostcss-modules
:and set config with
postcss.config.js
App.sass
:and I know it's gotta be transformed to:
this when I run
parcel
.App.js
I ran
parcel client/index.html
I checked the css bundle inside
dist
folder and it was still:which is obviously not transformed.
💁 Troubleshooting
Well, at least there is a workaround: adding
postcss
key topackage.json
.So I edited
package.json
by addingpostcss
:and now, the transformation works again. What's even more weird is that if you change the value of
autoprefixer
totrue
likeor do something like
the transformation will not again work. What??!?
Please help me. I know it works with
package.json
but it's just not pretty puttingpostcss
key in there. I wanna keep it clean.💻 Code Sample
You can reproduce this problem in this way:
git clone https://github.com/9oelM/super-fullstack.git
package.json
to delete the wholepostcss
key and its valueparcel client/index.html
dist
folder.🌍 Your Environment
FYI, I'm using c9.io.
The text was updated successfully, but these errors were encountered: