-
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
pkg_npm not compatible with output from rollup_bundle(output_dir = True)
#1567
Comments
It might be because of your typos: ts_library(
name = "compile",
srcs = glob(["*.ts"]),
tsconfig = '//:tsconfig.json',
)
rollup_bundle(
name = "bundle",
entry_point = "index.ts"
deps = [":compile"],
format = "esm",
output_dir = True
)
pkg_npm(
name = "npm",
srcs = ["package.json"],
deps = [":bundle"],
) dependencies should be referenced by their target label, in your case by prefixing with |
Colons are optional and only a matter of convention
However, I did write up the example build code quickly for this ticket, it is not exactly from my codebase, but it gives the general idea. |
I am currently using this patch to check for directories and copy their contents into the npm archive. rules_nodejs-1.1.0-c97bf38546c220fa250ff2cc052c1a9eac977c662c1fc23eda797b0ce8e70a43.patch.txt It seems using directories is frowned upon in Bazel, but I am not sure what any better way would be since Rollup is deciding where to chunk modules, and not something that is necessarily obvious or statically analyzable. |
@joeljeske would you mind turning your patch into a PR? I agree we should be special casing directories in this code. |
…nto mirrored structure in the npm archive.
…nto mirrored structure in the npm archive.
@nickbehrens thanks for the invitation! I just finished posting a PR for the change. |
🐞 bug report
Affected Rule
The issue is caused by the rule:pkg_npm
Is this a regression?
I do not think soDescription
A clear and concise description of the problem...pkg_npm is unable to make an archive using outputs that are directories. This might typically happen when using
rollup_bundle(output_dir = True)
to create a bundle with multiple chunks, howeverrollup_bundle
declares a directory rather than the individual files. This results in an output that cannot be added to a pkg_npm archive.🔬 Minimal Reproduction
🔥 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?
The text was updated successfully, but these errors were encountered: