Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.
This repository was archived by the owner on May 12, 2022. It is now read-only.

Incorrect line numbers in stack traces #36

Description

@broofa

When running with this loader, stack trace errors are incorrect.

Recipe

Create a basic test file that has a comment in it, like so:

$ cat test.ts
//
// This is a comment
//

throw Error('BLARG')

Run using bare node.js and notice the the log output (correctly) says the error is on line 5:

$ node test.ts
/private/tmp/_util/test.ts:5
throw Error('BLARG')
^

Error: BLARG
    at Object.<anonymous> (/private/tmp/_util/test.ts:5:7)
    ...

Now run using this loader, and notice that the error is logged as appearing on line 1:

$ node --loader=esbuild-node-loader test.ts
(node:72676) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
file:///private/tmp/_util/test.ts:1
throw Error("BLARG");
      ^

Error: BLARG
    at file:///private/tmp/_util/test.ts:1:7
...

Environment

$ npx envinfo --system --browsers --npmPackages --binaries

  System:
    OS: macOS 12.0.1
    CPU: (8) x64 Apple M1
    Memory: 20.41 MB / 16.00 GB
    Shell: 5.1.8 - /usr/local/bin/bash
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.14.0/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
    Watchman: 2022.02.14.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 100.0.4896.75
    Firefox: 98.0.2
    Safari: 15.1
  npmPackages:
    esbuild-node-loader: 0.8.0 => 0.8.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions