-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
🐞 Describe the Bug
The in-IDE debug/breakpoint experience for developers working on Ember apps is currently broken because of the difference in rendered source maps vs the source code in the code editor.
Example: For a component with a colocated template, like so:
import Component from "@glimmer/component";
export default class PeopleListComponent extends Component {
constructor() {
...
The generated source map looks like so:
import { hbs } from 'ember-cli-htmlbars';
const __COLOCATED_TEMPLATE__ = hbs... <hbs contents and options here>
import Component from "@glimmer/component";
export default class PeopleListComponent extends Component {
constructor() {
These extra two lines at the top of the source map pushes all lines in the component down, resulting in discrepancy in breakpoint line numbers. Breakpoints in browser's developer tools still work fine. But for breakpoints set in JS files in code editors (Example: VS Code) where the two lines don't exist, the line numbers don't match and the debugging experience is broken as a result
🔬 Minimal Reproduction
- Create a component with template
- Build and run with source maps
- View generated component code with sourcemaps applied
😕 Actual Behavior
Viewing code with sourcemap applied shows two extra lines of code at the top of the component
import { hbs } from 'ember-cli-htmlbars';
const __COLOCATED_TEMPLATE__ = hbs... <hbs contents and options here>
🤔 Expected Behavior
Source maps should map exactly to the source the developer is working on
🌍 Environment
- Ember: - 3.17.0
- Node.js/npm: - v12.16.2
- OS: - macOS Catalina
- Browser: - Firefox andGoogle Chrome
➕ Additional Context
I have consistently verified this behavior for components, but I haven't looked at such possible discrepancies in other types of JS files like services and routes. I'll update this bug if I find more other occurrences of this issue beyond components.