Hi, thanks for the reply.
I’m not too familiar with Webpack, but to me, basic source maps configuration seems fine. This line in particular:
devtool: production ? undefined : 'eval-cheap-source-map',
But let me explain. I used getting started example:
npx makes aurelia
Default TypeScript Aurelia 2 App
npm start
And, before even trying to debug the my-app
code in Chrome Dev tools, I tried to put breaking point in Aurelia 2 code. It does now show any Typescript maps.
But, on further inspection, even the app code does not contain correct source maps. For example, src/my-app.ts
that I did not change from default:
export class MyApp {
public message = 'Hello World!';
}
has a “map” like this:
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import * as __au2ViewDef from './my-app.html';
import { customElement } from '@aurelia/runtime-html';
let MyApp = class MyApp {
constructor() {
this.message = 'Hello World!';
}
};
MyApp = __decorate([
customElement(__au2ViewDef)
], MyApp);
export { MyApp };
Dev tools confirm that - "source mapped from my-app.ts
", when I try to put breaking point. So maps are there, but they are not correct.
It’s similar situation for Aurelia framework files, only that it says - "source mapped from index.js
", and it shows already processed JavaScript in the map (variable names are lost). Small snipped of mapped code is here:
function o(t) {
switch (typeof t) {
case "number":
case "bigint":
return true;
default:
return false;
}
}
So ideally, I would prefer debugging TypeScript source code, but it does not seem to work out of the box at all.