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

feat(esbuild): add 'sourcemap' option to configure sourcemap generation #2528

Merged
merged 4 commits into from
Mar 18, 2021

Conversation

mattsoulanille
Copy link
Contributor

@mattsoulanille mattsoulanille commented Mar 14, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

I'm pretty sure docs are auto-generated from the doc kwarg of attributes. If not, then docs have not been updated.

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Currently, there is no way to have esbuild include inlined sourcemaps in the output bundle.

Issue Number: N/A

What is the new behavior?

By passing sourcemap_inline = True to an esbuild rule named bundle, sourcemaps will be generated inline in bundle.js as well as externally in bundle.js.map.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The motivation behind this feature is to make it easier to use esbuild as part of a development server. Inline sourcemaps are easier to correctly set up than external sourcemaps.

The argument is named sourcemap_inline instead of sourcemap since it can only add inline sourcemaps to the bundle. We can't let users directly change the sourcemap argument to esbuild, since that argument can turn off the generation of the external sourcemap file, which is a required output of the rule.

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…emaps

Inline sourcemaps are useful in debug servers and are easier to correctly set up than external sourcemaps.
@google-cla google-cla bot added the cla: yes label Mar 14, 2021
@mattsoulanille
Copy link
Contributor Author

mattsoulanille commented Mar 14, 2021

Actually, this doesn't solve the problem I was having with sourcemaps on my dev server, and it doesn't seem to be necessary. Setting sourcemap_content = True is what I needed.

I'm still going to open this PR in case this feature is useful, but feel free to close it.

@mattsoulanille mattsoulanille marked this pull request as ready for review March 14, 2021 03:26
@mattsoulanille mattsoulanille changed the title feat(esbuild): add 'sourcemap_inline' option to generate inline sourcemaps feat(esbuild): add 'sourcemap' option to configure sourcemap generation Mar 18, 2021
@mattem
Copy link
Collaborator

mattem commented Mar 18, 2021

lgtm thanks! 🙏

@mattem mattem merged commit 8d0218c into bazel-contrib:stable Mar 18, 2021
@mattsoulanille mattsoulanille deleted the sourcemap_inline branch March 18, 2021 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants