Skip to content

Instantly share code, notes, and snippets.

@royib
Last active January 25, 2023 10:06
Show Gist options
  • Save royib/4c8fdcda62624c5fe26ae9af8999115b to your computer and use it in GitHub Desktop.
Save royib/4c8fdcda62624c5fe26ae9af8999115b to your computer and use it in GitHub Desktop.
bazel react build file
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//react-project-1:webpack-cli/package_json.bzl", "bin")
npm_link_all_packages(
name = "node_modules",
)
js_library(
name = "lib",
srcs = ["package.json", ".babelrc"] + glob(["src/**/*.jsx", "src/**/*.js", "src/**/*.css", "src/**/*.scss", "public/**/*"]),
deps = [
":node_modules/css-loader",
":node_modules/mini-css-extract-plugin",
":node_modules/@babel/core",
":node_modules/@babel/preset-env",
":node_modules/@babel/preset-react",
":node_modules/@svgr/webpack",
":node_modules/babel-loader",
":node_modules/html-webpack-plugin",
":node_modules/sass",
":node_modules/sass-loader",
":node_modules/style-loader",
":node_modules/react",
":node_modules/react-dom"
],
)
bin.webpack_cli(
name = "react-project-1-bundle",
srcs = [
":lib",
":webpack.config.js",
],
outs = [
"dist/main.js",
"dist/main.css",
"dist/index.html",
],
args = [
"--config webpack.config.js",
],
chdir = package_name(),
log_level = "debug",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment