What happened?
paths resolution does not work for entries in .swcrc with keys not ending in /*. That is,
such setup works
{
"jsc": {
"paths": {
"@modules/*": [
"./modules/*"
]
}
}
}
while this one does not
{
"jsc": {
"paths": {
"@modules/moduleB": [
"./modules/moduleB"
]
}
}
}
Interestingly enough, pure swc compiler resolves such paths correctly.
Version
Development (host) and target OS/architectures: Ubuntu 20, x86_64
Output of bazel --version: bazel 6.2.1
Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: just clone the rules_swc repo
Language(s) and/or frameworks involved:
How to reproduce
1. `git clone https://github.com/aspect-build/rules_swc.git`
2. `cd rules_swc/examples/`
3. `npm i @swc/cli @swc/core@1.3.42`
4. add `"scripts": {"swc": "swc paths/"}` to `examples/package.json`
5. change the content of `examples/paths/.swcrc` to
{
"jsc": {
"parser": {
"syntax": "typescript"
},
"target": "es2021",
"baseUrl": "./src",
"paths": {
"@modules/moduleB": [
"./modules/moduleB"
],
"@modules/moduleA": [
"./modules/moduleA"
]
}
},
"module": {
"type": "commonjs"
},
"sourceMaps": true
}
6. `npm run swc` (see the output, it works correctly, e.g. `const _moduleB = require("../moduleB")`)
7. `cd ../` (now you should be in `rules_swc`)
8. `curl -L https://github.com/bazelbuild/bazel/releases/download/6.2.1/bazel-6.2.1-linux-x86_64 -o bazel`
9. `chmod +x bazel`
10. `./bazel build //examples/paths:compile`
11. `cat bazel-bin/examples/paths/src/modules/moduleA/index.js`
You can see `const _moduleB = require("@modules/moduleB");` in the output
Any other information?
No response
What happened?
pathsresolution does not work for entries in.swcrcwith keys not ending in/*. That is,such setup works
{ "jsc": { "paths": { "@modules/*": [ "./modules/*" ] } } }while this one does not
{ "jsc": { "paths": { "@modules/moduleB": [ "./modules/moduleB" ] } } }Interestingly enough, pure
swccompiler resolves such paths correctly.Version
Development (host) and target OS/architectures: Ubuntu 20, x86_64
Output of
bazel --version: bazel 6.2.1Version of the Aspect rules, or other relevant rules from your
WORKSPACEorMODULE.bazelfile: just clone the rules_swc repoLanguage(s) and/or frameworks involved:
How to reproduce
Any other information?
No response