Skip to content
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

[BUGFIX lts] build: Turn off sourcemaps for TS-to-ES compilation #17128

Merged
merged 3 commits into from
Oct 18, 2018

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Oct 18, 2018

We seem to use Babel to compile ES to AMD modules and that now includes ES modules there were originally written in TypeScript. The TypeScript compiler is apparently outputting sourcemaps by default, but it looks like Babel can't handle those properly. Instead Babel keeps the sourcemap comments inside of the AMD modules, which causes the final concatenated file to have multiple sourcemap comments, which is invalid. Future versions of Babel might fix this but for now we should turn off the TypeScript sourcemaps, so that the final build output is valid again.

Resolves #16881

/cc @rwjblue @buschtoens @gossi

@rwjblue
Copy link
Member

rwjblue commented Oct 18, 2018

I mentioned this in discord chat, but would you mind bringing the test from 5e1f2f3 over? I really would like to do something to ensure we don't regress this in the future...

We seem to use Babel to compile ES to AMD modules and that now includes ES modules there were originally written in TypeScript. The TypeScript compiler is apparently outputting sourcemaps by default, but it looks like Babel can't handle those properly. Instead Babel keeps the sourcemap comments inside of the AMD modules, which causes the final concatenated file to have *multiple* sourcemap comments, which is invalid. Future versions of Babel might fix this but for now we should turn off the TypeScript sourcemaps, so that the final build output is valid again.
@Turbo87
Copy link
Member Author

Turbo87 commented Oct 18, 2018

@rwjblue using sourcemap-validator did not help, as that only validates the content of the sourcemap, but not if it's correctly specified in the original JS code. I've added a test that explicitly checks that there is only ever exactly one sourcemap comment in the final assets.

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Turbo87

@Turbo87
Copy link
Member Author

Turbo87 commented Oct 18, 2018

@rwjblue looks like CI is not building the production assets. should I modify the tests to skip then?

@rwjblue rwjblue merged commit cb12520 into emberjs:master Oct 18, 2018
@Turbo87 Turbo87 deleted the sourcemaps branch October 18, 2018 16:02
@buschtoens
Copy link
Contributor

Thank you so much, @Turbo87 & @rwjblue ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dist/ember.prod.js has multiple sourcemap declarations, breaking sourcemap build
3 participants