-
Notifications
You must be signed in to change notification settings - Fork 522
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
Regression in 1.6.0 module name mapping stopped working with tsc #1830
Comments
@gregmagolan did a bunch of refactoring in the module_mappings code such as |
Thanks for the pointer. I dug a bit more and found that The issue with our It would be great to have official upstream support for |
Glad your use case is unblocked! |
If |
#1896 for that new feature request |
🐞 bug report
Affected Rule
The issue is caused by the rule:
tsc
Is this a regression?
Yes, the previous version in which this bug was not present was: 1.1.0
Description
We use
tsc
from@npm//typescript:index.bzl
directly to compile TypeScript code. The motivation is to have tighter control of the compilation, in particular produce commonjs outputs. We use it to produce several publishable interdepending npm packages, to that end we set a custommodule_name
e.g.@my/lib
and rely onrules_nodejs
's module name remapping feature for imports of the form@my/lib
to map to the correct files in the execroot.With the update of
rules_nodejs
from 1.1.0 to 1.6.0 the module name remapping broke for these rules. I.e. imports of the form@my/lib
no longer resolve the correct sources in the execroot and fail with🔬 Minimal Reproduction
bazel build //:uselib
🔥 Exception or Error
🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_nodejs version:
(Please check that you have matching versions between WORKSPACE file and
@bazel/*
npm packages.)Anything else relevant?
We write a custom rule to adorn the outputs of
tsc
with themodule_name
attribute that is picked up by the module name remapper ofrules_nodejs
1.1.0.See aherrmann/repro_rules_nodejs_module_mapping@7761eff
For reference the same reproduction works with
rules_nodejs
1.1.0.See aherrmann/repro_rules_nodejs_module_mapping@7761eff
A successful build produces the following log
rules_nodejs
1.6.0 introducests_project
and theLinkablePackageInfo
provider.Using these still leads to a failure to resolve
@my/lib
.See aherrmann/repro_rules_nodejs_module_mapping@90aa842
A failing build produces the following log
The text was updated successfully, but these errors were encountered: