Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

tsx in vs code debugger watching the dist files rather than the src ts file for changes #654

Open
5 of 6 tasks
RahulBadenkal opened this issue Sep 15, 2024 · 0 comments
Open
5 of 6 tasks
Labels
bug Something isn't working pending triage

Comments

@RahulBadenkal
Copy link

RahulBadenkal commented Sep 15, 2024

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand this is a bug tracker and anything other than a proven bug will be closed
  • I understand this is a free project and relies on community contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://stackblitz.com/edit/node-i1hqro

Problem & expected behavior (under 200 words)

Setup (same as attached stackblitz link)

main.ts

type Name = string;

export const sayHello = (name: Name) => {
  console.log('Hello', name);
}

sayHello('World');

esbuild.config.mjs

import { build } from 'esbuild';
import { resolve } from 'path';


await build({
  entryPoints: [resolve(process.cwd(), 'main.ts')],
  outfile: resolve(process.cwd(), 'dist', 'index.mjs'),
  bundle: true,
  platform: 'node',
  format: 'esm',
  minify: false,
  sourcemap: true,
  external: ["node_modules/*"]
})

launch.json

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "current file",
        "type": "node",
        "request": "launch",
  
        // Debug current file in VSCode
        "program": "${file}",
  
        /*
         * Path to tsx binary
         * Assuming locally installed
         */
        "runtimeExecutable": "tsx",
        "runtimeArgs": ["watch", "--inspect"],
  
        /*
         * Open terminal when debugging starts (Optional)
         * Useful to see console.logs
         */
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen",
  
        // Files to exclude from debugger (e.g. call stack)
        "skipFiles": [
          // Node.js internal core modules
          "<node_internals>/**",
  
          // Ignore all dependencies (optional)
          "${workspaceFolder}/node_modules/**"
        ]
      }
    ]
  }

Steps to reproduce

  1. Run the app via the vs code debugger, make changes, the changes reflect and the debugger restarts -> working as expected
    image

  2. Now run the build node esbuild.config.js. It produces dist/index.mjs. Now run the program via the debugger again, instead of watching main.ts, its logs say its watching dist/index.mjs, which it should not. Thus any change i make in main.ts is not causing the debugger to refresh
    image

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support
@RahulBadenkal RahulBadenkal added bug Something isn't working pending triage labels Sep 15, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working pending triage
Projects
None yet
Development

No branches or pull requests

1 participant