-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit 2ebbff4
feat(@angular/build): allow enabling Bazel sandbox plugin with esbuild
Setting the new `ENABLE_BAZEL_SANDBOX_PLUGIN` environment variable to `true` or `1`
during a build with the `esbuild` based builder will now inject a special plugin to
make `esbuild` compatible with Bazel builds in the output tree.
When trying to integrate the `esbuild` based builder into Bazel with `rules_js` we found
that it will incorrectly follow symlinks out of the sandbox. This is because Node.js based
tooling runs in the output tree to support canonical JS project directory structures. The
output tree will contain symlinks outside of the sandbox. Node tooling will generally
follow these symlinks, which violates the rules of Bazel sandboxing. This can manifest
in a wide variety of errors. One example we encountered with Angular compilation
is that the symlinked browser entry point (e.g. `main.ts`) is outside of the range of
`tsconfig.json` when the compiler follows the symlink.
The plugin itself was originally written in https://github.com/aspect-build/rules_esbuild.
The version container in this commit is a fork of https://github.com/aspect-build/rules_esbuild/blob/e4e49d3354cbf7087c47ac9c5f2e6fe7f5e398d3/esbuild/private/plugins/bazel-sandbox.js.
I've adapted the JS file to TypeScript and made no further changes.1 parent 6b4512b commit 2ebbff4
File tree
2 files changed
+135
-0
lines changed- packages/angular/build/src/tools/esbuild
2 files changed
+135
-0
lines changedLines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 | + | ||
32 | 33 |
| |
33 | 34 |
| |
34 | 35 |
| |
| |||
606 | 607 |
| |
607 | 608 |
| |
608 | 609 |
| |
610 | + | ||
611 | + | ||
612 | + | ||
613 | + | ||
614 | + | ||
615 | + | ||
616 | + | ||
617 | + | ||
618 | + | ||
619 | + | ||
620 | + | ||
621 | + | ||
622 | + | ||
609 | 623 |
| |
610 | 624 |
| |
611 | 625 |
| |
|
Lines changed: 121 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | ||
100 | + | ||
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | ||
105 | + | ||
106 | + | ||
107 | + | ||
108 | + | ||
109 | + | ||
110 | + | ||
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | ||
118 | + | ||
119 | + | ||
120 | + | ||
121 | + |
0 commit comments