You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per preceding discussion in the "javascript" channel of the "Bazel" Slack workspace, when using the latest version of rules_esbuild with the esbuild rule's new "bazel_sandbox_plugin" attribute (per #160) set to its default value of True, I find that TypeScript files that import other files from the same directory get rejected by the "bazel-sandbox" plugin. These files are referencing the adjacent files like this:
importclassesfrom'./Something.module.scss';
If I replace that with a bare file name, it seems to work without complaint:
It's possible for me to rewrite these paths in the import statements without the leading ./ as I showed above, but, unfortunately, when I do so, our linter programs can't process these files correctly. The only way I've found so far to allow our esbuild targets to continue building as they had been is to disable this plugin, setting the "bazel_sandbox_plugin" attribute to False.
Version
Development (host) and target OS/architectures: macOS, ARM64
Output of bazel --version:bazel 7.0.2
Version of the Aspect rules, or other relevant rules from your WORKSPACE.bazel or MODULE.bazel file:
Out of curiosity (a bit of a moonshot), do you think you could try the patch in this PR to see if it helps? Im wondering whether its the same symptoms + solution but for a different scenario
I'm wondering whether its the same symptoms + solution but for a different scenario.
I haven't tried it yet, but I see that you're looking for paths that start with "..", but in our case, the paths start with only a single period, meaning "right here in this same containing directory".
I'm wondering whether its the same symptoms + solution but for a different scenario.
I haven't tried it yet, but I see that you're looking for paths that start with "..", but in our case, the paths start with only a single period, meaning "right here in this same containing directory".
Ah good point, what if you modify the following line to if (result.path.startsWith(".")) {? Anecdotally paths that are not absolute at this stage trip up the sandbox plugin, causing them to be rejected (even though they are valid within the sandbox, but its doesnt know that without the paths being made absolute), so that change should still solve my case and hopefully yours too
What happened?
Per preceding discussion in the "javascript" channel of the "Bazel" Slack workspace, when using the latest version of rules_esbuild with the
esbuild
rule's new "bazel_sandbox_plugin" attribute (per #160) set to its default value ofTrue
, I find that TypeScript files that import other files from the same directory get rejected by the "bazel-sandbox" plugin. These files are referencing the adjacent files like this:If I replace that with a bare file name, it seems to work without complaint:
Is that intended behavior for this plugin? I see that it looks for paths that start with a period as one of its special cases that require it to carry on with remapping the resolved path under the execution root path.
It's possible for me to rewrite these paths in the import statements without the leading
./
as I showed above, but, unfortunately, when I do so, our linter programs can't process these files correctly. The only way I've found so far to allow ouresbuild
targets to continue building as they had been is to disable this plugin, setting the "bazel_sandbox_plugin" attribute toFalse
.Version
Development (host) and target OS/architectures: macOS, ARM64
Output of
bazel --version
:bazel 7.0.2
Version of the Aspect rules, or other relevant rules from your
WORKSPACE.bazel or MODULE.bazel file:
Language(s) and/or frameworks involved: JavaScript, TypeScript
How to reproduce
No response
Any other information?
No response
The text was updated successfully, but these errors were encountered: