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.

Generate static build with app.baseUrl

See original GitHub issue

Environment


  • Operating System: Linux
  • Node Version: v16.15.1
  • Nuxt Version: 3.0.0-rc.3
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: modules, colorMode, content
  • Runtime Modules: @nuxt/content@2.0.1, @nuxtjs/tailwindcss@5.1.2, @nuxtjs/color-mode@3.0.3
  • Build Modules: -

Reproduction

  1. git clone https://github.com/Atinux/content-wind
  2. cd content-wind
  3. yarn
  4. NUXT_APP_BASE_URL=/sub/ yarn generate

Describe the bug

During prerender, it seems that the /api path does not contains the app.baseUrl provided by nuxt (neither env or configuration in nuxt.config)

Additional context

No response

Logs

ℹ Prerendering 2 initial routes with crawler                                                    nitro 17:51:21
  ├─ / (751ms)                                                                                  nitro 17:51:21
  ├─ /api/_content/cache (9ms)                                                                  nitro 17:51:21
  ├─ /api/_content/navigation (5ms)                                                             nitro 17:51:21
  ├─ /api/_content/query/1354861641 (3ms)                                                       nitro 17:51:21
  ├─ /sub/ (17ms)                                                                               nitro 17:51:21
  ├─ /sub/about (16ms)                                                                          nitro 17:51:21
  ├─ /sub/test (21ms)                                                                           nitro 17:51:21
  ├─ /api/_content/query/4205208744 (3ms) (Error: [404] Document not found!)                    nitro 17:51:21
  ├─ /api/_content/query/896285848 (3ms) (Error: [404] Document not found!)                     nitro 17:51:21
  ├─ /api/_content/query/1501933505 (3ms) (Error: [404] Document not found!)                    nitro 17:51:21

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
danielroecommented, Jun 14, 2022

Thanks for the reproduction. It’s an issue with Nitro following the links with /sub prefixed. (Not an issue with useRoute().) PR incoming.

1reaction
danielroecommented, Jun 14, 2022

useRoute().path should not include the baseURL - if it does that’s a bug that needs to be addressed.

See: https://stackblitz.com/edit/github-vrnb5v

Read more comments on GitHub >

github_iconTop Results From Across the Web

nuxt.js - Why baseURL in nuxt builded app always like ...
I faced with problem: when running 'nuxt generate' process.server is true and process.browser is false. During generating, nuxt send queries to ...
Read more >
Configure the create-react-app public URL post-build with ...
For a project, I had the requirement of making the public URL of the application configurable via an environment variable that can be...
Read more >
Deployment | Create React App
The build folder with static assets is the only output produced by Create React App. However this is not quite enough if you...
Read more >
How could make baseURL settings support multi domains?
There is another way, by setting a different destination path for built files. I think the command is hugo -d so say hugo...
Read more >
An elegant solution of deploying React app into a subdirectory
An instruction for the solution with Base URL Element ... Prerequisites: This guide assumes that you build your app using create-react-app , use ......
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