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

fix(build): Fix sourcemaps #6352

Merged
merged 2 commits into from
Aug 17, 2022
Merged

fix(build): Fix sourcemaps #6352

merged 2 commits into from
Aug 17, 2022

Conversation

cpcallen
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Part of #5857.

Proposed Changes

  • Enable sourceMap in tsconfig.json. This alone is suffiicient to get functional, per-.ts-file sourcemaps in build/src/** that work in uncompiled mode (i.e. in the playground / tests). Moreover, no further changes are required for these to be ingested by gulp + Closure Compiler; the resulting sourcemaps—build/*_compressed.js.map—now correctly point at files in core/, blocks/, etc. This works when packaged and also when doing local testing in compiled mode of the checked-in build products (i.e., after they are copied to the repository root by checkinBuilt).

  • In order to get sourcemaps to work for local testing in compiled mode of the build products directly from build/, modify buildCompiled so that it creates symlinks in build/ to core/, blocks/ and generators/.

Behaviour Before Change

  • No sourcemaps in uncompiled mode.
  • In compiled mode (when packaged or checked in), sourcemaps point at .js files in build/src/.

Behaviour After Change

  • Sourcemaps point at .ts files in core/, blocks/ and generators/.

Reason for Changes

Sourcemaps are more useful if they point at the original sources.

Test Coverage

No manual testing changes anticipated.

Documentation

No documentation changes expected.

Get sourcemaps working again.

- The change in tsconfig.json is sufficient to get functional,
  per-.ts-file sourcemaps in build/src/** that work in
  uncompiled mode (i.e. in the playground / tests).
- No further changes are required for these to be ingested by
  gulp + Closure Compiler; the resulting files -
  build/*_compressed.js.map - now point at files in
  core/, blocks/, etc.  This works correctly when packaged and
  also when doing local testing in compiled mode of the checked-in
  build products (i.e., after they are copied to the repository
  root.)
- In order to get sourcemaps to work for local testing in
  compiled mode of the build products directly from build/,
  buildCompile now creates symlinks from build/ to core/,
  blocks/ and generators/.
Apparently I made this change locally and thought I had committed
it and force-pushed _before_ opening the PR, but it appears I
forgot to git add the change before the commit --amend /
push --force sequence.  Oops!
@cpcallen cpcallen merged commit e10bf99 into google:develop Aug 17, 2022
@cpcallen cpcallen deleted the fix-sourcemaps branch August 17, 2022 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants