Skip to content

Webpack typescript setup doesn't generate correct souremap #1052

@3cp

Description

@3cp

🐛 Bug Report

The source map for .ts file is not against original user source file, but a modified source file done by @aurelia/webpack-loader.

🤔 Expected Behavior

It should display original source in debugger.

😯 Current Behavior

Our webpack-loader did generate the initial source map

cb(null, result.code, result.map as any);
, but the ts-loader ignored incoming source map. This is a well known issue in ts-loader since 2017. TypeStrong/ts-loader#552

💁 Possible Solution

Not sure what can be done, as ts-loader assumes it's the first loader in the chain.

For reference, ts-loader only reads file contents but not the existing source map.
https://github.com/TypeStrong/ts-loader/blob/172ebeb10cc8d15b91eca0828943bf7b962b4366/src/index.ts#L35

🔦 Context

In our webpack-loader, the incoming sourcemap is ignored but that's fine, because our loader is the first to be run in the loader chain. The problem is that ts-loader assumes it's the first loader too.
In comparison, webpack+babel does give you correct source map.

💻 Code Sample

🌍 Your Environment

Software Version(s)
Aurelia
Language
Browser
Bundler
Operating System
NPM/Node/Yarn

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions