node_package rule

Rules

node_package

Example usage (generated)

load("@aspect_rules_js//js/private:node_package.bzl", "node_package")

node_package(
    # A unique name for this target.
    name = "",
    is_windows = false,
    # Must match the `name` field in the `package.json` file for this package.
    package = "",
)

name

A unique name for this target.

deps

Other node packages this one depends on.

This should include all modules the program may need at runtime.

In typical usage, a node.js program sometimes requires modules which were never declared as dependencies. This pattern is typically used when the program has conditional behavior that is enabled when the module is found (like a plugin) but the program also runs without the dependency.

This is possible because node.js doesn't enforce the dependencies are sound. All files under node_modules are available to any program. In contrast, Bazel makes it possible to make builds hermetic, which means that all dependencies of a program must be declared when running in Bazel's sandbox.

indirect

If True, this is an indirect node_package which will not linked at the top-level of node_modules

is_windows

package

Must match the name field in the package.json file for this package.

root_dir

For internal use only

src

A source directory or TreeArtifact containing the package files.

Can be left unspecified to allow for circular deps between node_packages.

version

Must match the version field in the package.json file for this package.


Macros and Functions

node_package_lib.impl

Example usage (generated)

load("@aspect_rules_js//js/private:node_package.bzl", "node_package_lib")

node_package_lib.impl(
    ctx = None,
)

ctx