-
Notifications
You must be signed in to change notification settings - Fork 10.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
[plugin-postcss] v2 postcss plugin causes build (but not develop) to fail #6880
Comments
Hi @seaneking, following your steps, I couldn't reproduce your error. Here's a simple reproduction code with the hello-world starter and using |
Hmm okay, any idea how I could go about debugging this? I'm not familiar enough with Gatsby's internals to know what could be causing Postcss to throw at that API (whatever it is, something to do with the |
@seaneking could you share with us a link to a github repo that shows this error? That'd be the easiest way for us to investigate the problem. |
@KyleAMathews sure thing, WIP migration here: https://github.com/littleplanetcreative/littleplanetcreative.com/tree/gatsby-v2 Trying to narrow it down but not getting far – removed |
@KyleAMathews, @Chuloo, I'm also seeing this issue. Here's an minimal gatsby project showing this issue (
The full terminal output is here. Hope that helps and let me know if there's anything I can do to help get this fixed. |
I was trying to lookup the problem ... only thing I dig so far is that webpack error(it is swallow by createErrorFromString ...)
after little googling, I think the bug might need to wait |
Off topic, I think the webpack error isn't much useful now, also see #6978
according to its code /**
* Convert a stringified webpack compilation error back into
* an Error instance so it can be formatted properly
* @param {string} errorStr
*/
function createErrorFromString(errorStr = ``, sourceMapFile) {
let _errorStr$split = errorStr.split(/\r\n|[\n\r]/g),
message = _errorStr$split[0],
rest = _errorStr$split.slice(1); // pull the message from the first line then remove the `Error:` prefix
// FIXME: when https://github.com/AriaMinaei/pretty-error/pull/49 is merged
message = message.replace(/^(Error:)/, ``);
let error = new Error(message);
error.stack = [message, rest.join(`\n`)].join(`\n`);
error.name = `WebpackError`;
// ...
return error;
} the PR url mentioned in fixme is already merged AriaMinaei/pretty-error#49 so, upgrade pretty-error to 2.2.0-rc.1, then change this function to function createErrorFromString(errorStr = ``, sourceMapFile) {
const pe = new PrettyError();
const error = pe.render(new Error(errorStr));
try {
if (sourceMapFile) prepareStackTrace(error, sourceMapFile);
} catch (err) {// don't shadow a real error because of a parsing issue
}
return error;
} doing the same job, while giving more information here |
@seaneking @andrewn I spent so much time to debug this ... turn out your gatsby-plugin-postcss plugin version is still in v1, and I am keep looking at v2's source code....... 😂😂😂😂😂 run following command and your error goes away yarn upgrade gatsby-plugin-postcss@2.0.0-beta.2 the real reason behind this is that v1's gatsby-plugin-postcss include |
🤦♂️ 🤦♂️ 🤦♂️ I'm so sorry about this @youngboy. You're completely right. Upgrading to Thanks so much for figuring this out! |
Thanks everyone for working together on this! |
Description
Including the new
gatsby-plugin-postcss
plugin in a v2 site is causing prod build to fail, but dev mode works fine.Steps to reproduce
Include
gatsby-plugin-postcss
and try to build site.Expected result
Should work the same as develop build.
Actual result
Production build breaks when compiling HTML.
Environment
The text was updated successfully, but these errors were encountered: