You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was suggested by some visitor last week (sorry I forgot who)
https://github.com/bazelbuild/rules_nodejs/blob/3a35786d8e78627f9e0783fbf45e1c960eaccdf8/examples/rollup/BUILD.bazel#L16 has an example of our typical pattern: you read the bin entry from the package.json and put that in the BUILD file.
It would be better to point to the package, or the package.json, and let the rule read the package.json to find the bin.
This would make it more robust (in case the bin changes in a new version of the package) and less boilerplate to ask Bazel to run an arbitrary program we fetched from NPM.
The text was updated successfully, but these errors were encountered:
This is related to #302. With #302, yarn_install and npm_install will auto-generated nodejs_binary targets for executables in npm packages such as rollup. For cases where there are no templated_args (like the one referenced in the initial comment), you will be able to use the premade nodejs_binary targets in the form @<workspace>//:<package>/<binary>. For example, with a yarn_install(name = "npm", ...) where the package.json includes rollup, you will get an auto-generated nodejs_binary target @npm//:rollup/rollup
@gregmagolan I think we can close this now that we generate nodejs_binary for packages that have a bin in package.json?
I agree. entry_point is now also a label so you can easily create your own nodejs_binary and point the entry point to your node_modules such as entry_point = "@npm//:node_modules/rollup/bin/rollup"
This was suggested by some visitor last week (sorry I forgot who)
https://github.com/bazelbuild/rules_nodejs/blob/3a35786d8e78627f9e0783fbf45e1c960eaccdf8/examples/rollup/BUILD.bazel#L16 has an example of our typical pattern: you read the
bin
entry from thepackage.json
and put that in the BUILD file.It would be better to point to the package, or the package.json, and let the rule read the package.json to find the bin.
This would make it more robust (in case the
bin
changes in a new version of the package) and less boilerplate to ask Bazel to run an arbitrary program we fetched from NPM.The text was updated successfully, but these errors were encountered: