Comments (6)
Same issue here, but our case is quite different. We have a middleware that redirects path /
to /home
for example, adding page/index.vue
works on route correction, but for some reason, nuxt could not initialized properly, such as runtime public configs went missing + client-side plugins were not registered.
from nuxt.js.
The project is going to be placed on a php hoster (that is the reason for generate
), where the index.php is already occupied by the main website (that is the reason, why the change is hurtful).
from nuxt.js.
A crude FIX:
- add an empty
pages/index.vue
, - generate, and
- remove the index.html before generating the next project/deployment.
or: downgrade nuxt
from nuxt.js.
Apologies for this. We will be able to revert this when we upgrade nitro to the next version.
In the mean time you should be able to use the nitro prerender:routes
hook to remove the index route.
from nuxt.js.
@danielroe there seems to be an additional problem. Using:
{
nitro: {
prerender: {
crawlLinks: false,
// ignore: ['/'], -- how to address index? using this, no route will be generated anymore
routes: ['/about'],
},
}
}
it will always generate a html file: 200.html
Unfortunately, crawlLiks:false
will not "validate" any links anymore, but ignore:['/']
will just block any route defined in routes:[]
.
... can this 200.html
be blocked? Or the index be targeted better?
Trying to filter a '/' or alike from the hooks's ctx.routes does not work for me. Any advice on how to use it in my case? (I can't seem to find out what could work)
trying
{nitro:
prerender: {
crawlLinks: true,
routes: ['/about'],
},
hooks: {
"prerender:generate"(route) {
if (route.route === '/' || route.route === '/200.html') {
route.skip = true;
}
},
},
}
I get (without index.vue):
├─ / (507ms)
└── Error: [404] Page not found: / (skipped)
is this supposed to trigger an abort error, even thought I filtered it to skip ?
Using reference: https://nuxt.com/docs/getting-started/prerendering
from nuxt.js.
Here's a workaround for now:
import { useNitro } from '@nuxt/kit'
export default defineNuxtConfig({
devtools: { enabled: true },
hooks: {
'build:done'() {
useNitro().hooks.hook('prerender:routes', (routes) => {
routes.delete('/')
})
}
},
})
from nuxt.js.
Related Issues (20)
- You must define the vuex store in the server side and use VuexPersistencePlugin in the plugin list. HOT 3
- Nuxt doesn't update when making CSS changes HOT 2
- Nuxt 4 - allow flat layers directory structure without needing `layers` directory, allow each layer to have its own server routes HOT 1
- Nuxt 4 - Internal server error: Failed to resolve import "@vue/devtools-kit"
- Keep context when opening error page
- Wrapping useFetch in a function causes hydration mismatch HOT 6
- Middleware issue when redirecting with encodeURIComponent HOT 6
- keepalive include Bug HOT 1
- Server (api routes) not working in new app structure HOT 5
- `Nuxt 3.12` - app broke after upgrading. Vue Router warn: No match found for location with path "/settings/account" (repeated 24 times) HOT 1
- Build failing in production (Digital Ocean) - ERROR Cannot find module '/workspace/@nuxtjs/supabase' 3.11.2 - 3.12.2 HOT 10
- Build issue: Lexical.node.mjs not found, only Lexical.prod.mjs present HOT 7
- API behind routing rule provides cryptic response HOT 6
- Documentation Improvment - All package managers throughout docs HOT 3
- Improve Nuxt auto-imports to ignore undefined name properties HOT 3
- Why can't some of my modules be placed in devDependencies?
- Add an option for adding global route middleware that will be executed before all scanned middlewares. HOT 1
- Unable to send options via `addServerHandler` HOT 1
- Default value types of runtime config overwrite global typing HOT 1
- useRequestURL is not defined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.js.