NuxtN
Nuxt16mo ago
sean

Dynamic route returns 404 in production

Hi, I have a simple nuxtjs website and made a dynamic loaded page /bot/botId fetchs the bot and builds a ui based on that.

Now when I run npm run preview after build and try it out my browser gets 404 at these routes in the network tab.

I saw this https://github.com/nuxt/nuxt/issues/28692 issue on github BUT how would I do that in the preview mode? Also when I host it on github pages I have the same issue. I cannot "prerender" it since there are over 44k Discord bots on Discord :NM3_Eyes:

I use NuxtLayout and NuxtPage.

My file path is
/pages/bot/[bot].vue

With this content:

<template>
  <div>
    <Title>Bot</Title>
    BotBotBotBotBotBotBotBotBotBotBot
  </div>
</template>

<script setup lang="ts">

</script>


In dev mode I dont even get any warning and it works how I expect it.
Was this page helpful?