nikneym
nikneym
NNuxt
Created by nikneym on 11/27/2024 in #❓・help
Using protobufs with Nuxt
(also added this run script)
pbjs --target json proto/*.proto -o shared/proto/proto.json
pbjs --target json proto/*.proto -o shared/proto/proto.json
7 replies
NNuxt
Created by nikneym on 11/27/2024 in #❓・help
Using protobufs with Nuxt
I think I've found a better solution, by adding these imports I can use the generated json in both vue & nitro apps
import { createResolver } from "nuxt/kit";
import pbjs from "protobufjs-cli/pbjs";

// https://nuxt.com/docs/api/configuration/nuxt-config
export 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",
]);
},
},
});
import { createResolver } from "nuxt/kit";
import pbjs from "protobufjs-cli/pbjs";

// https://nuxt.com/docs/api/configuration/nuxt-config
export 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",
]);
},
},
});
7 replies
NNuxt
Created by nikneym on 7/14/2024 in #❓・help
Nuxt way to teleport modals
Thanks, I'll stick to body then
4 replies
NNuxt
Created by nikneym on 7/10/2024 in #❓・help
Passing props vs `useNuxtData`
I'll probably not going to use pinia since that way I simply replicate what nuxt already do
3 replies
NNuxt
Created by nikneym on 7/10/2024 in #❓・help
Passing props vs `useNuxtData`
what are the upsides of provide/inject compared to useNuxtData? I believe useNuxtData does a hash map match, not sure how provide/inject resolves stuff
3 replies
NNuxt
Created by nikneym on 5/18/2024 in #❓・help
Writing a Nuxt 3 module with TailwindCSS
I still couldn't find a documentation on this, can anyone help?
2 replies