Skip to content

Bug: Requiring "coffeescript" breaks Node.js built-in source map support globally #5382

Closed
@jaens

Description

@jaens

Node.js has built in support for source maps via the --enable-source-maps command-line option.
If any library at any point requires "coffeescript", that support gets completely broken (ie. Node.js stack traces stop processing source maps for eg. TypeScript).

I am guessing this is due to the entry point in coffee-script.js unconditionally overriding Error.prepareStackTrace.

Input Code

test.ts, compiled to test.js (with sourcemaps).
package.json has "type": "module" (probably irrelevant).

import 'coffeescript';

throw new Error("test");

Run with node --enable-source-maps test.js.

Expected Behavior

Stack trace refers to test.ts.

Current Behavior

Stack trace refers to test.js.

Context

One of the libraries I use requires "coffeescript" and now all my stack traces are broken.

Environment

  • CoffeeScript version: 2.6.0
  • Node.js version: 16.10

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