-
Notifications
You must be signed in to change notification settings - Fork 205
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
language-support/ts generate package in commonjs format #4380
Conversation
CHANGELOG_BEGIN CHANGELOG_END
The npm packages generated by rules_nodejs' native ts_library rule use the UMD package format. This breaks webpack which attempts to determine dependencies by static code analysis and fails on UMD. To avoid this we call `tsc` directly to ensure generation of commonjs modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this looks much simpler than I though it would be.
One comment on package names.
The first attempt didn't work because it generated conflicting outputs with the Taking a step back, we don't need the |
srcs = outs, | ||
# We don't do anything with the deps, but they are needed for | ||
# rules_nodejs's tracking of transitive dependencies. | ||
deps = deps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we find deps, via the global npm deps repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rules_nodejs traces them through this attribute and makes sure they're in the right place in the execroot. They come either from local targets or from the npm deps repo. E.g. https://github.com/digital-asset/daml/pull/4380/files#diff-cb32cca6075c7ecf0996019a06da7488R16-R20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thanks for the explanation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me with my limited knowledge of bazel.
data = [ | ||
":LICENSE", | ||
":README.md", | ||
":package.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these files still included in the package with the new rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes they are, just checked.
The npm packages generated by rules_nodejs' native ts_library rule use
the UMD package format. This breaks webpack which attempts to determine
dependencies by static code analysis and fails on UMD. To avoid this we
call
tsc
directly to ensure generation of commonjs modules.Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.