Skip to content

Commit

Permalink
fix: make bb.js work on server
Browse files Browse the repository at this point in the history
  • Loading branch information
olehmisar committed Dec 7, 2024
1 parent 5a2d2ae commit 949c0a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"scripts": {
"dev": "pnpm _chore && vite dev --port 5193",
"build": "pnpm _chore && pnpm test:lint && vite build",
"build": "pnpm _chore && pnpm test:lint && vite build --ssr",
"preview": "vite preview",
"test": "pnpm test:lint && pnpm test:unit",
"test:unit": "pnpm _chore && vitest run",
Expand Down
8 changes: 4 additions & 4 deletions apps/interface/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { sveltekit } from "@sveltejs/kit/vite";
import fs from "node:fs";
import path from "node:path";
import copy from "rollup-plugin-copy";
import { defineConfig, type Plugin, type UserConfig } from "vite";
import { defineConfig, type Plugin } from "vite";
import resolve from "vite-plugin-resolve";

export default defineConfig({
export default defineConfig((configEnv) => ({
plugins: [
sveltekit(),
copy({
Expand All @@ -18,7 +18,7 @@ export default defineConfig({
wasmContentTypePlugin(),
resolve({
util: `export const inspect = {}`,
...(process.env.NODE_ENV === "production"
...(process.env.NODE_ENV === "production" && !configEnv.isSsrBuild
? {
// `unreachable` error in wasm is caused by incorrect version of bb.js. Consult pnpm-lock.yaml
"@aztec/bb.js": `export * from "https://unpkg.com/@aztec/bb.js@0.55.0/dest/browser/index.js"`,
Expand All @@ -39,7 +39,7 @@ export default defineConfig({
testTimeout: 99999999,
teardownTimeout: 99999999,
},
} satisfies UserConfig);
}));

function wasmContentTypePlugin(): Plugin {
return {
Expand Down

0 comments on commit 949c0a3

Please sign in to comment.