question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prerendering doesn't respect `baseURL`

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.1
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

  • npx nuxi init nuxt-app
  • cd nuxt-app
  • npm install
  • NUXT_APP_BASE_URL=/foo npm run generate

Describe the bug

When NUXT_APP_BASE_URL is specified, the deployed file does not have index.html

not specify NUXT_APP_BASE_URL

> npm run generate
> tree ./.output/public 
├── _nuxt
│   ├── entry-79c674ce.mjs
│   ├── entry.93eb12fa.css
│   └── manifest.json
└── index.html

1 directory, 4 files

specify NUXT_APP_BASE_URL

> NUXT_APP_BASE_URL=/foo npm run generate
> tree ./.output/public
.
└── _nuxt
    ├── entry-79c674ce.mjs
    ├── entry.93eb12fa.css
    └── manifest.json

1 directory, 3 files

missing index.html 😦

Additional context

No response

Logs

> generate
> nuxt generate

Nuxt CLI v3.0.0-rc.1                                                    16:21:28
ℹ Vite client warmed up in 1652ms                                       16:21:34
ℹ Client built in 1674ms                                                16:21:34
ℹ Building server...                                                    16:21:34
✔ Server built in 563ms                                                 16:21:34
✔ Generated public .output/public                                 nitro 16:21:34
ℹ Initializing prerenderer                                        nitro 16:21:34
ℹ Prerendering 1 initial routes with crawler                      nitro 16:21:37
  ├─ / (47ms) (Error: [404] Not Found)                            nitro 16:21:37
✔ You can now deploy .output/public to any static hosting!              16:21:37

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yoyo930021commented, Jul 8, 2022

The prerender with {crawlLinks: true} doesn’t support baseURL. It will generate baseURL folder in output files.

0reactions
danielroecommented, Jul 6, 2022

This should be resolved in nitropack v0.4.3. which you can get with yarn upgrade nuxt or npm upgrade nuxt.

Let me know if not and I’ll reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prerendering doesn't respect config.app.baseURL #4732
When using nuxt generate the prerenderer doesn't respect the baseURL . It will return a 404 for the default routes.
Read more >
99170 - config.baseURL and <base> tag functionality
baseURL has been deprecated. The option allowed to set a fixed URL which was then added as <base> tag to the HTML <head>...
Read more >
General tips and best practices - Troubleshooting - Prerender.io
The Prerender.io service fetches your site using the Prerender.io user agent, but it only renders, caches and stores the DOM, it doesn't ......
Read more >
Visual Studio Typescript Intellisense doesn't respect tsconfig ...
However, my intellisense shows errors for any imports using a path based on the baseUrl configured in my tsconfig.json.
Read more >
Running a Next.js Site on Cloudflare Pages - Opstrace
js static HTML export to prerender all pages to plain html. Given we don't use any server-side rendering capabilities at the moment, this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found