Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add vite box #5827

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions boxes/boxes/vanilla-vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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?
13 changes: 13 additions & 0 deletions boxes/boxes/vanilla-vite/index.html
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>
20 changes: 20 additions & 0 deletions boxes/boxes/vanilla-vite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@aztec/vanilla-vite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@aztec/aztec.js": "latest"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.2.0",
"vite-plugin-node-polyfills": "0.17.0",
"vite-plugin-top-level-await": "^1.4.1"
}
}
5 changes: 5 additions & 0 deletions boxes/boxes/vanilla-vite/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createPXEClient } from "@aztec/aztec.js";

const pxe = createPXEClient("http://10.10.1.79:8080");
const nodeInfo = await pxe.getNodeInfo();
console.log(nodeInfo);
1 change: 1 addition & 0 deletions boxes/boxes/vanilla-vite/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
23 changes: 23 additions & 0 deletions boxes/boxes/vanilla-vite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
13 changes: 13 additions & 0 deletions boxes/boxes/vanilla-vite/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "vite";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import topLevelAwait from "vite-plugin-top-level-await";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
// vite-plugin-node-polyfills over v0.17.0 has a buggy buffer polyfill
// https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81
nodePolyfills(),
topLevelAwait(),
],
});
Loading
Loading