kogratte
kogratte
NNuxt
Created by kogratte on 1/8/2025 in #❓・help
Third party static content
@kapa.ai , the result is working fine, except for anchors. Do I need to add this prerendered content to the nitro.prerender.routes rules in order to make them available "at build time"?
20 replies
NNuxt
Created by kogratte on 1/8/2025 in #❓・help
Third party static content
@kapa.ai for the record. The solution is to use serveStaticthrough a file placed in /server/routes/__path__/[...].ts. Otherwise, idwill never be hydrated. Full event handler :
import { defineEventHandler, serveStatic } from 'h3';
import { stat, readFile } from 'node:fs/promises';
import { join, resolve } from 'pathe';

const publicDir = resolve('./docs/');

export default defineEventHandler((event) => {
function cleanupId(id: string) {
return id.replace('/docs', '');
}

return serveStatic(event, {
getContents: (id) => {
return readFile(join(publicDir, cleanupId(id)));
},

getMeta: async (id) => {
const stats = await stat(join(publicDir, cleanupId(id))).catch(() => {});

if (!stats || !stats.isFile()) {
return;
}

return {
size: stats.size,
mtime: stats.mtimeMs
};
}
});
});
import { defineEventHandler, serveStatic } from 'h3';
import { stat, readFile } from 'node:fs/promises';
import { join, resolve } from 'pathe';

const publicDir = resolve('./docs/');

export default defineEventHandler((event) => {
function cleanupId(id: string) {
return id.replace('/docs', '');
}

return serveStatic(event, {
getContents: (id) => {
return readFile(join(publicDir, cleanupId(id)));
},

getMeta: async (id) => {
const stats = await stat(join(publicDir, cleanupId(id))).catch(() => {});

if (!stats || !stats.isFile()) {
return;
}

return {
size: stats.size,
mtime: stats.mtimeMs
};
}
});
});
20 replies
NNuxt
Created by kogratte on 1/8/2025 in #❓・help
Third party static content
@kapa.ai Serving content through public folder leads to an issue with mjs content being referenced.
20 replies
NNuxt
Created by Omnislash on 12/15/2024 in #❓・help
Wrapping useToast
Types can be imported using
import { POSITION, TYPE, useToast } from "vue-toastification";
import type { ToastOptions } from "vue-toastification/dist/types/types";
import { POSITION, TYPE, useToast } from "vue-toastification";
import type { ToastOptions } from "vue-toastification/dist/types/types";
7 replies
NNuxt
Created by kogratte on 12/2/2024 in #❓・help
Error: Vitest failed to access its internal state
@kapa.ai for me it seems it should be the default configuration. Could you report that?
15 replies
NNuxt
Created by kogratte on 12/2/2024 in #❓・help
Error: Vitest failed to access its internal state
@kapa.ai This is not the right answer. Nuxt is autoimporting server utils as well as their tests. I need to exclude a pattern from being imported. How?
15 replies
NNuxt
Created by kogratte on 12/2/2024 in #❓・help
Error: Vitest failed to access its internal state
@kapa.ai This is not the right answer. Nuxt is autoimporting server utils as well as their tests. I need to exclude a pattern from being imported. How?
15 replies
NNuxt
Created by kogratte on 11/7/2024 in #❓・help
TOO_MANY_REDIRECT - How to track the culprit?
Nb:never change your package management on a release day 🤣
13 replies
NNuxt
Created by kogratte on 11/7/2024 in #❓・help
TOO_MANY_REDIRECT - How to track the culprit?
It was due to looping deps. I though yarn was smart enough to manage them, but it does not seems to be the case.
13 replies
NNuxt
Created by kogratte on 11/7/2024 in #❓・help
TOO_MANY_REDIRECT - How to track the culprit?
@kapa.ai I ran my solution with the --inspect flag. Whats should I look for? I don't have a clue about any redirection. I need to set a breakpoint, but where?
13 replies
NNuxt
Created by Tiger Nut on 10/23/2024 in #❓・help
how to add a something to .nuxt/tsconfig.server.ts ?
Maybe even amend the generated file.
15 replies
NNuxt
Created by Tiger Nut on 10/23/2024 in #❓・help
how to add a something to .nuxt/tsconfig.server.ts ?
You may be able to push files at build time using hooks. I guess it could work... Let me know if the idea helps ☺️
15 replies
NNuxt
Created by Wontolla on 10/15/2024 in #❓・help
`nuxt/storybook` does not work
Doesn't work either. They're many issues opened.
6 replies
NNuxt
Created by Jonas on 10/14/2024 in #❓・help
ERROR [worker reload] [worker init] Package import specifier "#internal/nitro/virtual/app-config"
We had this issue with some libs as well. For us, the culprit was nuxt content which was doing wrong imports. You may have available updates, or modules to remove.
5 replies
NNuxt
Created by enricopolanski on 10/8/2024 in #❓・help
What are the main differences between a plugin and a module and when should they be used?
But an interesting one 🙂 lacking of knowledges, we simply pack our layer as a reusable package (internally available only). Retrospectively, was this the way to go or should we have instead choose this other path?
11 replies
NNuxt
Created by enricopolanski on 10/8/2024 in #❓・help
What are the main differences between a plugin and a module and when should they be used?
But, is there a difference with a layer packaged as a simple zip?
11 replies
NNuxt
Created by ZaKk on 10/3/2024 in #❓・help
delete pinia store data.
May it be due to a remaining ref to the store you're trying to delete?
34 replies
NNuxt
Created by ZaKk on 10/3/2024 in #❓・help
delete pinia store data.
Hey Zak! Did you find a way?
34 replies
NNuxt
Created by ZaKk on 10/3/2024 in #❓・help
delete pinia store data.
Was harsh. Sorry about that. Was missing some ctx.
34 replies
NNuxt
Created by ZaKk on 10/3/2024 in #❓・help
delete pinia store data.
The ideal would be to understand why this double logout is needed... Can't do that ^^
34 replies