Run Gridsome in a debugger.


New web site coming soon. Meanwhile, it's time to start writing things down again.

Here's how to debug Gridsome, the Vue-based static site generator, in JetBrains IDEs such as WebStorm. (I'm using RubyMine, but it should be the same.)

In package.json in your Gridsome project folder, find the line where the develop script is defined. Replace the definition with this one:

    "develop": "node $NODE_DEBUG_OPTION node_modules/.bin/gridsome develop",

Voila. Now you can run it in debug mode by clicking the green "Run Script" triangle and then "Debug develop".

$NODE_DEBUG_OPTION seems to be specific to JetBrains products, and has a different value depending on whether you're running the script in the debugger. If you're using another debugger, you can pass the flag explicitly:

node --inspect node_modules/.bin/gridsome develop

Similar techniques apply for Nuxt.js and other Node servers.

More posts:
comments powered by Disqus