Skip to content

Commit

Permalink
feat(react): use vite and vitest rather than react-scripts (#376)
Browse files Browse the repository at this point in the history
react-scripts (the build system stamped out by create-react-app aka CRA)
is no longer recommended by
https://react.dev/learn/start-a-new-react-project and instead developers
are encouraged to use 'a framework'.
In the "Can I use React without a framework?" section, they suggest
rolling up your sleeves and just use a bundler like Vite - that's what
we do here.

This PR mostly prepared just by following public guides, such as 

https://dev.to/henriquejensen/migrating-from-create-react-app-to-vite-a-quick-and-easy-guide-5e72

Note that vitest just hit 1.0 three days ago (as of this writing) so
it's good timing for us to demonstrate adoption. We got some confidence
in this recommendation since Sourcegraph recently did it:
https://github.com/sourcegraph/sourcegraph/pull/57886
  • Loading branch information
alexeagle authored Dec 8, 2023
1 parent b051dc6 commit e2746bf
Show file tree
Hide file tree
Showing 19 changed files with 85,954 additions and 127,521 deletions.
16 changes: 2 additions & 14 deletions frontend/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"Bazel module dependencies, see https://bazel.build/external/overview#bzlmod"

bazel_dep(name = "aspect_bazel_lib", version = "1.33.0")
bazel_dep(name = "aspect_rules_lint", version = "0.6.1")
bazel_dep(name = "aspect_rules_lint", version = "0.7.0")
bazel_dep(name = "aspect_rules_jest", version = "0.19.6")
bazel_dep(name = "aspect_rules_js", version = "1.32.2")
bazel_dep(name = "aspect_rules_swc", version = "1.0.2")
Expand All @@ -10,24 +10,12 @@ bazel_dep(name = "aspect_rules_rollup", version = "1.0.0")
bazel_dep(name = "aspect_rules_webpack", version = "0.13.0")
bazel_dep(name = "bazel_skylib", version = "1.4.2")

git_override(
module_name = "aspect_rules_lint",
commit = "270a3ea55ba4ee75f8fe15636c053c1cc7941e41",
remote = "https://github.com/aspect-build/rules_lint",
)

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm", dev_dependency = True)
use_repo(pnpm, "pnpm")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
bins = {
# derived from "bin" attribute in node_modules/react-scripts/package.json
"react-scripts": [
"react-scripts=./bin/react-scripts.js",
],
},
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
public_hoist_packages = {
Expand Down
Loading

0 comments on commit e2746bf

Please sign in to comment.