Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuxi genetate with wrong baseURL to _payload.js #15134

Closed
loo2k opened this issue Oct 11, 2022 · 3 comments
Closed

nuxi genetate with wrong baseURL to _payload.js #15134

loo2k opened this issue Oct 11, 2022 · 3 comments

Comments

@loo2k
Copy link

loo2k commented Oct 11, 2022

Environment

  • Operating System: Darwin
  • Node Version: v16.17.0
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: npm@8.15.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-egtlnd-lkqx3b?file=nuxt.config.ts

nuxt@3.0.0-rc.11 with config app.baseURL

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
  app: {
    baseURL: '/sub-path/',
  },
});

Describe the bug

I made configuration of app.baseURL with /sub-path/, and tried to use npm run generate to build static site.

I get result of the *.html in ./dist directory show that:

  • _paylaod.js get the wrong path
  • the other assets files are correct
  <link rel="modulepreload" href="/_payload.js">
  <link rel="modulepreload" as="script" crossorigin href="/sub-path/_nuxt/entry.96a10300.js">
  <link rel="modulepreload" as="script" crossorigin href="/sub-path/_nuxt/index.a407e84c.js">
  <link rel="modulepreload" as="script" crossorigin href="/sub-path/_nuxt/fetch.e898b128.js">
  <link rel="prefetch" as="script" crossorigin href="/sub-path/_nuxt/error-component.236c792e.js">
  <link rel="prefetch stylesheet" href="/sub-path/_nuxt/entry.26effea5.css">

It will lead to a 404 error when i deploy these file to my site.

Additional context

https://github.com/nuxt/framework/blob/ed1c704835c280cd2d7ad795452f2da9c8401e2a/packages/nuxt/src/core/runtime/nitro/renderer.ts#L191

The payloadURL is resolve incorrect.

Logs

No response

@loo2k loo2k changed the title pay nuxi genetate with wrong baseURL to _payload.js Oct 11, 2022
@danielroe
Copy link
Member

I believe this has already been resolved via nuxt/framework#7809.

Would you confirm by testing with the edge channel?

@loo2k
Copy link
Author

loo2k commented Oct 12, 2022

I trie to confirm in the edge channel, but when i reinstall dependecis, i got the errors below.

$ npm i --registry=https://registry.npmjs.com/

> postinstall
> nuxt prepare

Nuxi 3.0.0-rc.9-27702110.abd5dc5                                                                                                           12:10:34

 ERROR  defineNuxtConfig is not defined                                                                                                    12:10:34

  at nuxt.config.ts:2:16
  at Object.jiti (node_modules/jiti/dist/jiti.js:1:247502)
  at resolveConfig (node_modules/c12/dist/index.mjs:220:21)
  at loadConfig (node_modules/c12/dist/index.mjs:104:40)
  at async loadNuxtConfig (node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:678:18)
  at async loadNuxt (node_modules/nuxt/dist/index.mjs:1563:19)
  at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:732:19)
  at async Object.invoke (node_modules/nuxi/dist/chunks/prepare.mjs:29:18)
  at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

npm ERR! code 1
npm ERR! path /Users/vm/Code/test
npm ERR! command failed
npm ERR! command sh -c nuxt prepare

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vm/.npm/_logs/2022-10-12T04_10_32_934Z-debug-0.log

@danielroe
Copy link
Member

It looks like you are not using the latest edge version - you seem to be using an edge version from rc9.

Here's a reproduction of everything working fine with latest edge version: https://stackblitz.com/edit/github-vtrl2t. I'm going to close this issue, tentatively, but if you can provide a reproduction with an issue I will very happily reopen it. 🙏

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants