JuanP Barba
Extending nitro node-server preset/entry
The problem was that Rollup was excluding the import because the imported code wasn't being used.
This could be a possible solution:
https://stackblitz.com/edit/unjs-nitro-starter-nig5kw?file=server%2Fentry.ts
3 replies
middleware/redirect.global.js
If it is a Nuxt API endpoint, the problem is:
- when you call it from the server side, it is executed internally
- I think that you see two calls because the middleware is executed again when the API endpoint is called
- it seems that this behaivour is sending the response before the original call and that’s why you get “Cannot set headers after they sent to client”
16 replies
Pass extra dynamic data when routing to a page
The only thing that comes to mind is that you add the tag's slug to the keys of the posts as well...
If you don't want to make this modification, I would go with route rules and SSG for /tags/{tag}.
It will increase the build time, but I think all solutions for this issue (without extra key or getting tags out of posts) will ultimately involve some build script.
15 replies
Pass extra dynamic data when routing to a page
I think there could be better solutions that rely on your data rather than on Nuxt itself.
I mean, I'm not sure how you are getting the tags or how you are generating the /tags/{tag} page right now...
Perhaps a small example of the /tags/{tag} page could help.
15 replies
Typescript nested generic resolves to unknown
The problem at this example is with K definition.
Typescript is not able to infer value of T from generic K definition.
You should pass this directly to the argument:
https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABFApgZygHgCoD4AUAJgIZTEBciA3omOqoZQEooRwBOhmG7MYA5gBpEeRAF8AlNQBQiROxRQQ7JCTIA6OhhSEA3NLHTpbMBmT01xRAF4ZcrQ0pVZc8xicvXyGFAA2KSgBybHpAwU9xF0NDYwQzBTQQXygbNyh8VAxLCV0gA
7 replies