Skip to content

build: fix source maps in dev-app due to missing source contents #23925

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

Merged
merged 2 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions integration/size-test/index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def size_test(name, file, deps):
# Link the workspace root so that files can be loaded from the workspace.
link_workspace_root = True,
sourcemap = "external",
sources_content = True,
)

terser_minified(
Expand Down
14 changes: 13 additions & 1 deletion tools/esbuild/index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ load("//tools/esbuild:devmode-output.bzl", "extract_devmode_output_with_mappings
# Re-export of the actual esbuild definitions.
esbuild_config = _esbuild_config

def esbuild(name, deps = [], mapping_targets = [], testonly = False, **kwargs):
def esbuild(
name,
deps = [],
mapping_targets = [],
testonly = False,
# Inline source contents to make debugging easier. Contents are inlined by default
# in ESBuild but `@bazel/esbuild` sets the default to `false`. Inlining sources is
# helpful as otherwise developers would need to manually wire up the Bazel execroot
# as workspace in the Chrome devtools.
# https://github.com/bazelbuild/rules_nodejs/blob/c30a26c13d20dac48dc9f220370cb02a317b13f3/packages/esbuild/esbuild.bzl#L333.
sources_content = True,
**kwargs):
# Extract all JS module sources before passing to ESBuild. The ESBuild rule requests
# both the devmode and prodmode unfortunately and this would slow-down the development
# turnaround significantly. We only request the devmode sources which are ESM as well.
Expand All @@ -14,6 +25,7 @@ def esbuild(name, deps = [], mapping_targets = [], testonly = False, **kwargs):
_esbuild(
name = name,
deps = devmode_targets,
sources_content = sources_content,
testonly = testonly,
**kwargs
)
Expand Down