-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript sourcemaps do not work in an ember addon #1390
Comments
Thanks for filing this (and sorry about the delay in responding)! Not sure what the underlying cause of this issue is, so please feel free to dig and open a PR for it. Otherwise, one of the maintainers will hopefully eventually get to it in the midst of everything else! |
Update on this: the sourcemaps are actually working, it's just my config that is wrong! I was spitting through ember-cli-babel to see if there were any options I could play with, and there I saw that the babel config for addons is not supposed to go in Moving the config into index.js so that it now reads: 'use strict';
module.exports = {
name: require('./package').name,
options: {
babel: {
sourceMaps: 'inline',
},
},
}; Did the trick. Now adding a There is one more caveat which is so frustrating now that I've gotten so close: the generated sourcemap doesn't quite match the original source file. To be specific: there are two extra lines in the sourcemapped file: import { hbs } from 'ember-cli-htmlbars';
const __COLOCATED_TEMPLATE__ = hbs( //.... template html here // ); This causes the line-mapping to be off by two when integrating with an external debugger |
I will add that any typescript files which don't have anything to do with ember do map nicely and integrate as expected with my editor's debugger (jetbrains webstorm). |
The off-by-two-lines bug seems to come from ember itself and unrelated to typescript. I'll close it since it's not an issue for this project. |
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
In the add-on's documentation they recommend to edit the file `/ember-cli-build.js`: https://github.com/typed-ember/ember-cli-typescript/blob/4e4b161d55aae9d3409f7b7ad9630473af87109b/docs/configuration.md#enabling-sourcemaps But this is in the context of an application. Here, in the context of an add-on, this change must be done in the file `/index.js`: - typed-ember/ember-cli-typescript#1390 (comment) > ... I saw that the babel config for addons is not supposed to go in > `ember-cli-build.js` but in `index.js` - https://github.com/babel/ember-cli-babel/tree/88a8c8154e480cbbd01e96257c5a8097d6be79f1#options > There are a few different options that may be provided to > `ember-cli-babel`. These options are typically set in an apps > `ember-cli-build.js` file, or in an addon or engine's `index.js`.
Please paste the output of
ember -v
herePlease paste the output of
tsc -v
herePlease paste the version of
ember-cli-typescript
andember-cli-typescript-blueprints
herePlease paste your
tsconfig.json
andtslint.json
oreslint.json
(if applicable) belowMy tsconfig.json
What are instructions we can follow to reproduce the issue?
ember-cli-build.js
my-component.ts
my-component.hbs
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.
The text was updated successfully, but these errors were encountered: