emberjs / ember-cli-babel

Ember CLI plugin for Babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid source maps generated

wagenet opened this issue · comments

We're seeing situations where we get source maps with negative line numbers. I believe it only occurs in some of our TypeScript files. I hope to add more details to this ticket, but wanted to get something started for reference.

Our primary version is 7.22.1.

Looks like we are seeing this in some non-TS files as well.

@wagenet - Is this restricted to component files that are using colocation?

@rwjblue we are using colocation, but I'm not sure whether it is restricted to those only. I'll keep an eye out.

@wagenet - I was thinking about this PR where someone mentioned that the way we do colocation breaks things with sourcemaps ember-cli/ember-cli-htmlbars#558.

@rwjblue it certainly seems plausible.

The interesting thing for us is that it doesn't happen in every situation. The problem as described in ember-cli-htmlbars sounds like it would always be an issue.

@rwjblue I just found this issue while setting up breakpoints in VSCode and I believe this is indeed related to template co-location.

I've got a bare 3.21 app with 3 components in it

ember generate component -fs --with-component-class component-with-flat-structure
ember generate component -cs --with-component-class component-with-classic-structure
ember generate component -ns --with-component-class component-with-namespace-structure

babel: { sourceMaps: 'inline' } has been added to ember-cli-build.js.

The sourcemaps seems to be wrong for components component-with-flat-structure and component-with-namespace-structure and correct for component-with-classic-structure

I can setup a demo repo if necessary 👍

ember-cli/ember-cli-htmlbars#558 does fix the issue 👍

Edit

PR 558 does not perfectly correct the issue. To paraphrase @rwjblue in comment ember-cli/ember-cli-htmlbars#558 (comment)

We have to do something smarter than simply inserting the string contents