Search code examples
gatsby

Gatsby console.log statements don't get printed


I'm trying to solve an issue on Gatsby by placing some console.log statements on critical parts of the code that performs the build. However, these statements are not being printed to the console.

I've also tried using the debug() function that is used by Gatsby itself to print things like "Generating Static HTML" to the console, but it also doesn't work.

I'm using Gatsby installed locally and running it with ./node_modules/.bin/gatsby build.


Obs.: Log statements on gatsby/bin/gatsby.js do get printed, but not those on gatsby/lib/bin/cli.js or any other file imported by it.


Solution

  • You need to add the statements to gatsby/dist not gatsby/lib. I thought actually that the lib folder wasn't distributed... guess we need to fix the .npmignore then (https://github.com/gatsbyjs/gatsby/pull/609).