Zampa
Explore posts from serversAdding `/pages/index.vue` breaks e2e testing
Reproduction: https://stackblitz.com/edit/github-gu1sj1-xq3xf8?file=tests%2Fe2e%2Fbasic.e2e.test.ts
A minimal repo with just vitest and @nuxt/test-utils, an app.vue, and a
pages/index.vue
fails with error:
2 replies
Correct setup config for Test Utils
Reproduction: https://stackblitz.com/edit/github-gu1sj1?file=tests%2Fbasic.e2e.test.ts
Issue filed: https://github.com/nuxt/test-utils/issues/893
I can't seem to utilize the alternative nuxt.config location with @nuxt/test-utils. If I have my nuxt.config as
./.config/nuxt.ts
, e2e tests will always fail with Error: Invalid nuxt app. (Please explicitly set 'options.rootDir' pointing to a valid nuxt app)
.
This is my test:
and my nuxt.config:
If I move and rename nuxt.config back to the root, it works.
I'm not sure if this is a limitation or expectation of test-utils, or the config file name/location that isn't being honored by the configFile
setting, or what.1 replies
Can't deploy to Cloudflare with 3.12.2
I am still seeing an "unknown internal error" when deploying to Cloudflare Pages using Nuxt 3.12.1 or 3.12.2. Nuxt 3.11.2 deploys fine.
The end of my Cloudflare deployment log looks like this:
There's nothing in the full log that indicates what the internal error is.
Nuxt client built successfully:
Nuxt server built successfully:
I'm not sure what changed in 3.12.x that is causing CF Pages to fail?
21 replies
KPCKevin Powell - Community
•Created by Zampa on 5/28/2024 in #front-end
Modern version of stylelint-config-rational-order ?
I'd like to lean on stylelint to keep my properties in a rational order, but the existing stylelint-config-rational-order is outdated, and does not include any logical properties whatsoever (like margin-inline-start). Is there an up-to-date version of such a config for stylelint that includes all modern (as of 2024) CSS properties?
3 replies
Get dynamic array of page names in Nuxt application
I have a scenario where I'd like to add a middleware that references an array of all the page names that exist at the root of the application (i.e. /user, /faq, /about, etc.).
Rather than hardcode an array of all those names
['user', 'faq', 'about']
, is there some way via Nitro or Nuxt to parse/call to get all the page names that exist within the current Nuxt application?11 replies
KPCKevin Powell - Community
•Created by Zampa on 1/19/2024 in #front-end
How do you set proportional border-widths based on image size?
10 replies
KPCKevin Powell - Community
•Created by Zampa on 11/15/2023 in #front-end
Dynamic Font Size Based On Container & Text Length
7 replies
KPCKevin Powell - Community
•Created by Zampa on 11/7/2023 in #front-end
What are the best practices for the number of srcset items for a dynamically sized image?
2 replies
Different URLs for client XHR request and SSR XHR requests?
Does anyone know if there is a way to use one URL for all SSR-initiated API XHR requests, and another URL for all browser (client-side) API XHR requests?
I'm noticing that if I have API calls in a server route, it's adding 5x delay to the raw XHR request that happens in the browser.
Example:
Call the API endpoint in the browser: 20-30ms
Nuxt SSR calls the API endpoint from a Nuxt server route: 150-200ms
So presumably there is some way to do this using middleware? A custom wrapper for all API requests (
/api/*
) that would either :
1) use a fully qualified API endpoint URL (https://api.mysite.com/api/...) for all client-side API calls
2) use a relative API endpoint URL ('/api/...
) that references the Nuxt server route /api/[...].ts
for all server-initiated API calls (any time a page is server rendered, and that page requires data from an external API1 replies
Nuxt 3 Custom Loading Component
Is there an equivalent to Nuxt 2's custom
<Loading>
component available in Nuxt 3, with start()
. finish()
, fail()
?
https://nuxtjs.org/docs/features/loading/#using-a-custom-loading-component
I only see https://nuxt.com/docs/api/components/nuxt-loading-indicator in the Nuxt 3 docs, so I was curious if there was any internal initiative to replicate this in Nuxt 3?
The note here leads me to believe it's planned but not implemented: https://nuxt.com/docs/migration/component-options#loading
Perhaps now it would be a quick one to knock out since Nuxt 3.0.0 is out?5 replies