-
-
Notifications
You must be signed in to change notification settings - Fork 65
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]: JSON data from ts_project
not found at runtime
#250
Comments
I have been investigating this and it seems a similar issue happens with imported JS files (when I suspect they both have the same root cause (unverified at this point): ts_project seems to never declare input files as dependencies of its output. It seems to only ever declare new tsc outputs. In other words, for each input it currently decides between the following two states:
IIUC we'd need to add the following state:
IMO this can most easily be seen between the following two lines: rules_ts/ts/private/ts_project.bzl Line 209 in 5ea2d01
rules_ts/ts/private/ts_project.bzl Line 242 in 5ea2d01
==> all non-transitive JS sources must be default outputs. This is blocking our migration to rules_ts, so I might spend some more time looking into this. Any pointers are appreciated. |
As a workaround: The json inputs can be added to the |
What happened?
After discussion in the Bazel Slack in the
#javascript
channel, opening an issue here to track this apparent bug.Given a a
ts_project
that resolves data as a "JSON module", when running ajs_binary
that depends on thatts_project
, the JSON file is not found at runtime. The expected behavior is that the data would be included at runtime. It is also expected that the data be available at compile time since it may imported, not only by it's local package target, but by otherts_project
s that depend on it.Version
Development (host) and target OS/architectures:
Output of
bazel --version
:bazel 5.3.2
Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:rules_ts-1.0.0-rc6
Language(s) and/or frameworks involved: TypesScript, JavaScript
How to reproduce
A branch reproducing the issue can be found here: https://github.com/loudmouth/bazel-rules_js-poc/tree/ts_project-data
Just try to running
bazel run //app/app-a:main
and the output will be:"Error: Cannot find module './data.json'"
Any other information?
Linking to the Slack thread since there was already discussion as to (a) possible fix(es)
The text was updated successfully, but these errors were encountered: