-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 602c759
Showing
17 changed files
with
1,626 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea | ||
node_modules |
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 @@ | ||
7.4.0 |
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,26 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
/bazel-* |
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,15 @@ | ||
load("@aspect_rules_ts//ts:defs.bzl", "ts_config", "ts_project") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
load("@npm//:vite/package_json.bzl", "bin") | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
ts_config( | ||
name = "tsconfig", | ||
src = "tsconfig.json", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
bin.vite_binary( | ||
name = "vite", | ||
) |
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,38 @@ | ||
module( | ||
name = "bazel-rules-js-vite", | ||
version = "1.0", | ||
) | ||
|
||
bazel_dep(name = "aspect_bazel_lib", version = "2.7.7") | ||
bazel_dep(name = "aspect_rules_js", version = "2.1.0") | ||
bazel_dep(name = "aspect_rules_swc", version = "2.0.1") | ||
bazel_dep(name = "aspect_rules_ts", version = "3.2.1") | ||
bazel_dep(name = "bazel_skylib", version = "1.6.1") | ||
bazel_dep(name = "rules_nodejs", version = "6.3.1") | ||
|
||
# JavaScript and TypeScript | ||
# ========================= | ||
|
||
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True) | ||
node.toolchain(node_version = "20.18.0") | ||
|
||
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm", dev_dependency = True) | ||
pnpm.pnpm( | ||
name = "pnpm", | ||
pnpm_version = "9.10.0", | ||
pnpm_version_integrity = "sha512-c6Ka+jag0JLs5Scd5Rd+y/gxjUVOzXATQxMbjrwMGpHEh9pGq3fI5ZbWrPFGHjWUztS+zt+JIbB0+9hlPtcFHA==", | ||
) | ||
use_repo(pnpm, "pnpm") | ||
|
||
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True) | ||
npm.npm_translate_lock( | ||
name = "npm", | ||
no_optional = True, | ||
pnpm_lock = "//:pnpm-lock.yaml", | ||
verify_node_modules_ignored = "//:.bazelignore", | ||
) | ||
use_repo(npm, "npm") | ||
|
||
rules_ts = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True) | ||
rules_ts.deps() | ||
use_repo(rules_ts, "npm_typescript") |
Large diffs are not rendered by default.
Oops, something went wrong.
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,27 @@ | ||
# Bazel rules-js vite | ||
|
||
This repo contains a minimal example of attempting to use Vite with Bazel | ||
rules_js. | ||
|
||
To run: | ||
|
||
```bash | ||
bazelisk run //:vite -- --help | ||
``` | ||
|
||
``` | ||
$BAZEL_OUT/darwin_arm64-fastbuild/bin/vite_/vite.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules/rollup/dist/native.js:63 | ||
throw new Error( | ||
^ | ||
Error: Cannot find module @rollup/rollup-darwin-arm64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory. | ||
at requireWithFriendlyError ($BAZEL_OUT/darwin_arm64-fastbuild/bin/vite_/vite.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules/rollup/dist/native.js:63:9) | ||
at Object.<anonymous> ($BAZEL_OUT/darwin_arm64-fastbuild/bin/vite_/vite.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules/rollup/dist/native.js:72:76) | ||
... 3 lines matching cause stack trace ... | ||
at Module._load (node:internal/modules/cjs/loader:1104:12) | ||
at cjsLoader (node:internal/modules/esm/translators:346:17) | ||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:286:7) | ||
at ModuleJob.run (node:internal/modules/esm/module_job:234:25) | ||
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24) { | ||
[cause]: Error: Cannot find module '@rollup/rollup-darwin-arm64' | ||
``` |
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,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + TS</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
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,19 @@ | ||
{ | ||
"name": "bazel-rules-js-vite", | ||
"private": true, | ||
"type": "module", | ||
"packageManager": "[email protected]", | ||
"pnpm": { | ||
"onlyBuiltDependencies": [] | ||
}, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"typescript": "~5.6.2", | ||
"vite": "^5.4.9" | ||
} | ||
} |
Oops, something went wrong.