Skip to content

Commit

Permalink
feat(esbuild): support transitive runfiles when importing css
Browse files Browse the repository at this point in the history
  • Loading branch information
dae committed Apr 7, 2021
1 parent 62a024a commit c792db4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/esbuild/esbuild.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def _esbuild_impl(ctx):
elif hasattr(dep, "files"):
deps_depsets.append(dep.files)

if DefaultInfo in dep:
deps_depsets.append(dep[DefaultInfo].data_runfiles.files)

if NpmPackageInfo in dep:
deps_depsets.append(dep[NpmPackageInfo].sources)
npm_workspaces.append(dep[NpmPackageInfo].workspace)
Expand Down
16 changes: 14 additions & 2 deletions packages/esbuild/test/css/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,26 @@ copy_to_bin(
srcs = ["external.css"],
)

ts_library(
name = "dep",
srcs = [
"dep.ts",
],
data = [
":external_copied",
],
deps = [
"@npm//@types/node",
],
)

ts_library(
name = "main",
srcs = [
"main.ts",
],
deps = [
":dep",
"@npm//@types/node",
],
)
Expand All @@ -22,7 +36,6 @@ esbuild(
name = "default",
entry_point = "main.ts",
deps = [
"external_copied",
":main",
],
)
Expand All @@ -32,7 +45,6 @@ esbuild(
entry_point = "main.ts",
output_css = True,
deps = [
"external_copied",
":main",
],
)
Expand Down
3 changes: 3 additions & 0 deletions packages/esbuild/test/css/dep.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import "./external.css";

export function dep() {}
4 changes: 3 additions & 1 deletion packages/esbuild/test/css/main.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import "./external.css";
import { dep } from "./dep";

dep();

0 comments on commit c792db4

Please sign in to comment.