Skip to content

Commit

Permalink
add supports_webpack and run_js_devserver example (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
KatSick authored Nov 2, 2023
1 parent 5b68345 commit 140ad9f
Show file tree
Hide file tree
Showing 6 changed files with 3,685 additions and 673 deletions.
34 changes: 34 additions & 0 deletions e2e/loaders/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@aspect_rules_webpack//webpack:defs.bzl", "webpack_bundle")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@aspect_rules_js//js:defs.bzl", "js_run_devserver")
load("@npm//:http-server/package_json.bzl", http_server_bin = "bin")

http_server_bin.http_server_binary(
name = "http_server",
)

npm_link_all_packages(name = "node_modules")

Expand Down Expand Up @@ -62,6 +68,34 @@ webpack_bundle(
],
)

# supports_worker + js_run_devserver
webpack_bundle(
name = "html",
srcs = [
"src/component.js",
"src/index.html",
"src/styles.css",
],
node_modules = "//:node_modules",
output_dir = True,
supports_workers = True, # <- does not work with js_run_devserver. if False -> it works
webpack_config = ":webpack.html.cjs",
deps = [
":node_modules/css-loader",
":node_modules/html-webpack-plugin",
":node_modules/mini-css-extract-plugin",
],
)

#
js_run_devserver(
name = "devserver",
chdir = package_name(),
data = [":html"],
log_level = "debug",
tool = ":http_server",
)

build_test(
name = "test",
targets = [
Expand Down
4 changes: 4 additions & 0 deletions e2e/loaders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"webpack": "5.76.2",
"webpack-cli": "5.0.1",
"webpack-dev-server": "4.13.1"
},
"dependencies": {
"html-webpack-plugin": "^5.5.3",
"http-server": "^14.1.1"
}
}
Loading

0 comments on commit 140ad9f

Please sign in to comment.