pbjs --target json proto/*.proto -o shared/proto/proto.json
import { createResolver } from "nuxt/kit";import pbjs from "protobufjs-cli/pbjs";// https://nuxt.com/docs/api/configuration/nuxt-configexport default defineNuxtConfig({ compatibilityDate: "2024-11-01", devtools: { enabled: true }, nitro: { experimental: { websocket: true, }, imports: { dirs: ["shared"], }, }, imports: { dirs: ["../shared"], }, hooks: { // generate protobufs before building the nuxt app "build:before": () => { const { resolve } = createResolver(import.meta.url); const proto = resolve("./proto"); const shared = resolve("./shared"); pbjs.main([ "--target", "json", proto + "/*.proto", "-o", shared + "/proto/proto.json", ]); }, },});
body
useNuxtData