-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a895e7d
commit 23a0669
Showing
9 changed files
with
229 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""webpack_binary helper macro""" | ||
|
||
load("@aspect_bazel_lib//lib:directory_path.bzl", "directory_path") | ||
load("@aspect_rules_js//js:defs.bzl", "js_binary") | ||
|
||
def webpack_binary( | ||
name, | ||
node_modules, | ||
additional_packages): | ||
"""Create a webpack binary target from linked node_modules in the user's workspace. | ||
Requires that `webpack` and any additional packages specified are linked into the supplied node_modules tree. | ||
Args: | ||
name: Unique name for the binary target | ||
node_modules: Label pointing to the linked node_modules tree where webpack is linked, e.g. `//:node_modules`. | ||
additional_packages: list of additional packages required. For example ["webpack-cli", "webpack-dev-server"] | ||
""" | ||
|
||
directory_path( | ||
name = "{}_entrypoint".format(name), | ||
directory = "{}/webpack/dir".format(node_modules), | ||
path = "bin/webpack.js", | ||
) | ||
|
||
data = ["{}/webpack".format(node_modules)] | ||
for p in additional_packages: | ||
data.append("{}/{}".format(node_modules, p)) | ||
|
||
js_binary( | ||
name = name, | ||
data = data, | ||
entry_point = ":{}_entrypoint".format(name), | ||
visibility = ["//visibility:public"], | ||
) |
Oops, something went wrong.