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

[Bug]: __dirname is not hermetic #1669

Open
hunshcn opened this issue Apr 20, 2024 · 0 comments
Open

[Bug]: __dirname is not hermetic #1669

hunshcn opened this issue Apr 20, 2024 · 0 comments
Labels
bug Something isn't working untriaged Requires traige

Comments

@hunshcn
Copy link
Contributor

hunshcn commented Apr 20, 2024

What happened?

In some scenarios, the path pointed by __dirname is not in runfiles.

Version

Development (host) and target OS/architectures:

Output of bazel --version: 7.1.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 1.41.0

Language(s) and/or frameworks involved: js

How to reproduce

https://github.com/hunshcn/vitets_alias_broken


bazel run //portal:vite

see output of
```js
console.log(path.resolve('src/'))
console.log(path.resolve(__dirname, 'src/'))
/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/portal/vite.sh.runfiles/_main/portal/src
/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/portal/src

This will lead to some strange problems, such as built twice #1645

Vite is used in this example (because it is found in production). The problem should be reproduced in a smaller way. But because I am not proficient in js, to be honest, I don't even know how cjs/mjs/ts work together directly. I only tried pure cjs without this problem.

Any other information?

No response

@hunshcn hunshcn added the bug Something isn't working label Apr 20, 2024
@github-actions github-actions bot added the untriaged Requires traige label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
None yet
Development

No branches or pull requests

1 participant