Issue: Currently facing challenges while setting up a new NodeJS Project using KoaJS, Typescript, and Docker. The initial setup went as planned, but encountering some difficulties with remote debugging - or at least it seems so from my perspective.
When starting the application and utilizing the "Attach to Node.js/Chrome" Debug Setting in Webstorm, the debugger functions... partially. I am able to reach the breakpoint, however, the same file (e.g., kernel.ts) is being opened again from the docker workdir in Webstorm.
It appears like this:
Fig 1: Kernel.ts with Breakpoint
Fig 2: File opened from docker workdir
Moreover, after navigating through the breakpoints, any additional breakpoints added do not take effect.
Configuration:
DockerFile
FROM node:11.1.0-alpine
WORKDIR /share/example
COPY package.json .
RUN npm install --quiet
COPY . .
DockerCompose
version: '3'
services:
web:
container_name: example_web
build: .
command: npm run debug
volumes:
- .:/share/example
- /share/example/node_modules
ports:
- "3000:3000"
- "9229:9229"
package.json script
"debug": "nodemon --inspect=0.0.0.0:9229 -e ts,tsx --exec node -r ts-node/register ./src/kernel.ts",
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "./dist",
"sourceMap": true,
"inlineSources": true
},
"include": [
"./src/**/*"
]
}
Inquiry: Is this setup feasible? Compiling typescript and running the app with compiled js while debugging with breakpoints set in the typescript file?
I suspect that my typescript configuration might be causing issues. There could be something about Webstorm not recognizing that the kernel.ts in the docker container is the same as the opened file... or maybe Webstorm understands it correctly but my configuration is lacking.
Note: I attempted the same setup without Typescript and it worked smoothly (remote debugging and avoiding reopening the same file from the docker workdir but directly jumping to the file where the breakpoint was placed). Hence, I presume that the typescript configuration is deficient or there is a misunderstanding on my part.