v0.11.0
Pre-releasewebpack_repositories
repository rule is removed and a new node_modules
attribute is now required for both webpack_bundle
and webpack_devserver
. This change is BREAKING for all users.
After debugging errors with complex webpack configurations with clients we found that fetching webpack in webpack_repositories
and linking into a node_modules
tree within an external Bazel repository can lead to unexpected errors with some webpack plugins that don't expect webpack to be found in multiple node_modules
trees. To fix this problem in the simplest and most general way, this release removes webpack_repositories
and now expects users to provide the target to their own node_modules
trees that must include the webpack
, webpack-cli
and, for the webpack_devserver
rule, also the webpack-dev-server
npm packages.
The //path/to:node_modules
tree target must be passed to the webpack_bundle
and webpack_devserver
rules via the node_modules
attribute. For example,
webpack_bundle(
name = "bundle",
node_modules = "//:node_modules",
...
)
This change has the added benefits of not requiring users to keep the webpack version used in their package.json
in sync with their WORKSPACE and not requiring any changes to rules_webpack
to support new releases of webpack.
WORKSPACE snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "aspect_rules_webpack",
sha256 = "2841761bdf7e82f05a00c388e97c7b81dd47b55a30c5bf4109e96aad041352cf",
strip_prefix = "rules_webpack-0.11.0",
url = "https://github.com/aspect-build/rules_webpack/releases/download/v0.11.0/rules_webpack-v0.11.0.tar.gz",
)
#######################
# rules_webpack setup #
#######################
# Fetch the Bazel module dependencies
load("@aspect_rules_webpack//webpack:dependencies.bzl", "rules_webpack_dependencies")
rules_webpack_dependencies()
# Fetch and register a nodejs interpreter, if you haven't already
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
nodejs_register_toolchains(
name = "node",
node_version = DEFAULT_NODE_VERSION,
)
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
What's Changed
- chore: update deps by @gregmagolan in #109
- refactor: remove vendored webpack versions, user must provider their own webpack tool from their node_modules by @gregmagolan in #110
Full Changelog: v0.10.1...v0.11.0