Recommended VSCode debug launch.json

default discord avatar
8 months ago

So I'm hitting some server issues and I'd really like to try and debug what is happening in Payload. I've leveraged the default Node JS launch.js which is:

{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Program", "skipFiles": [ "<node_internals>/**" ], "program": "${workspaceFolder}\\src\\server.ts", "outFiles": [ "${workspaceFolder}/**/*.js" ] } ] }

But I get the following error when I run the debugger:

Process exited with code 1 Uncaught SyntaxError C:\Users\gregw\git\user-settings\src\server.ts:1 import express from 'express' ^^^^^^ SyntaxError: Cannot use import statement outside a module at compileFunction (vm:352:18) at wrapSafe (internal/modules/cjs/loader:1032:15) at Module._compile (internal/modules/cjs/loader:1067:27) at Module._extensions..js (internal/modules/cjs/loader:1155:10) at Module.load (internal/modules/cjs/loader:981:32) at Module._load (internal/modules/cjs/loader:822:12) at executeUserEntryPoint (internal/modules/run_main:77:12) at <anonymous> (internal/main/run_main_module:17:47)


  • discord user avatar
    Payload Team
    7 months ago

    Hey @gregwhitworth where did you find that snippet? What exactly are you attempting to debug?

    Here is a snippet we use to launch test directories:

      "version": "0.2.0",
      "configurations": [
          "type": "node",
          "request": "launch",
          "name": "Launch Program",
          "runtimeArgs": [
          "args": [

    Can also be found here:
  • default discord avatar
    5 months ago

    @gregwhitworth , did you solve? I'm also receiving a SyntaxError: Cannot use import statement outside a module error

  • default discord avatar
    3 months ago

    @taun2160 follow the link @jarrod_not_jared has shared. works perfectly

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.