Thursday 12 November 2020

webstorm debugging with babel7 "--require @babel/register"

I am trying to run the webstorm debugger for a node.js express app on my laptop using babel7. When I run the application by clicking the debug symbol, the application starts and displays a message indicating it is listening on port 3000 as expected. However, when I try to access the endpoints it is just clocking and none of my endpoints are getting hit. On my local environment, I tried two approaches, how I have on the server where I have a server.js as the entry point which and another approach where I am using www.js as the entry point. Both approaches, start the application and appear to listen.

I am setting the following Run/Debug Configuration properties:

enter image description here

babel.config.json:

{
  "presets": [
    ["@babel/preset-env"]
  ],
  "plugins": [
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-object-rest-spread"
  ]
}

This is the server.js file:

require("core-js");
require("regenerator-runtime");
module.exports = require('./bin/www');

It appears as if the application is running and listening but unresponsive, I am not seeing any breakpoints hit and no console.log message are appearing in the console. I also pushed the code up to the test server and it works fine from there. The only x factor I can think of is that the test server uses the babel command to transpile the code to a different folder to run from there as opposed to transpiling on the fly using @babel/register. What could I missing here?



from webstorm debugging with babel7 "--require @babel/register"

No comments:

Post a Comment