Skip to content

Typescript sourcemaps do not work in an ember addon #1390

@abeforgit

Description

@abeforgit

Please paste the output of ember -v here

ember-cli: 3.22.0
node: 14.15.0
os: linux x64

Please paste the output of tsc -v here

Version 4.1.2

Please paste the version of ember-cli-typescript and ember-cli-typescript-blueprints here

[email protected] /home/arne/repos/redpencil/playground/ts3
├─┬ @glimmer/[email protected]
│ └── [email protected] 
├── [email protected] 
├── [email protected] 
└─┬ [email protected]
  └── [email protected] 

Please paste your tsconfig.json and tslint.json or eslint.json (if applicable) below

My tsconfig.json
{
"compilerOptions": {
  "target": "es2020",
  "allowJs": true,
  "moduleResolution": "node",
  "allowSyntheticDefaultImports": true,
  "noImplicitAny": true,
  "noImplicitThis": true,
  "alwaysStrict": true,
  "strictNullChecks": true,
  "strictPropertyInitialization": true,
  "noFallthroughCasesInSwitch": true,
  "noUnusedLocals": true,
  "noUnusedParameters": true,
  "noImplicitReturns": true,
  "noEmitOnError": false,
  "noEmit": true,
  "inlineSourceMap": true,
  "inlineSources": true,
  "baseUrl": ".",
  "module": "es6",
  "experimentalDecorators": true,
  "paths": {
    "dummy/tests/*": [
      "tests/*"
    ],
    "dummy/*": [
      "tests/dummy/app/*",
      "app/*"
    ],
    "ts3": [
      "addon"
    ],
    "ts3/*": [
      "addon/*"
    ],
    "ts3/test-support": [
      "addon-test-support"
    ],
    "ts3/test-support/*": [
      "addon-test-support/*"
    ],
    "*": [
      "types/*"
    ]
  }
},
"include": [
  "app/**/*",
  "addon/**/*",
  "tests/**/*",
  "types/**/*",
  "test-support/**/*",
  "addon-test-support/**/*"
]
}

What are instructions we can follow to reproduce the issue?

ember addon sample; cd ./sample # Create a new ember app
ember install ember-cli-typescript # Set up typescript support
ember generate component my-component
ember serve

ember-cli-build.js

'use strict';

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
  let app = new EmberAddon(defaults, {
    babel: {
      sourceMaps: 'inline'
    }
  });


  return app.toTree();
};

my-component.ts

import Component from '@glimmer/component';

interface MyComponentArgs {}

export default class MyComponent extends Component<MyComponentArgs> {
  get content():string {
    debugger;
    return "test"

  }
}

my-component.hbs

<div>{{this.content}}</div>

tests/dummy/app/templates/application.hbs

  <MyComponent />

Now about that bug. What did you expect to see?

When running this with the chromium debug tools open, I expect to see the original typescript code when the breakpoint is hit.

What happened instead?

I see the compiled javascript instead. It's readable, so it looks like some kind of sourcemaps are provided. But it would be nice to be able to see the actual typescript code like it does when you make a typescript app, not an addon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuildIdeas for or bugs with the build process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions