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

When a cdnURL is supplied in nuxt config, the ErrorComponent disregards this setting #14649

Closed
ffxsam opened this issue Aug 19, 2022 · 4 comments

Comments

@ffxsam
Copy link

ffxsam commented Aug 19, 2022

Environment

Nuxt CLI v3.0.0-rc.8
RootDir: /Volumes/SuperData/Sites/reelcrafter/v2-presentation-nuxt3
Nuxt project info:


  • Operating System: Darwin
  • Node Version: v16.15.0
  • Nuxt Version: 3.0.0-rc.8
  • Package Manager: yarn@3.2.1
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Putting together a repro will be a little tricky with this one since it requires a deploy to a valid URL. I can set one up later and add it to the issue, but I wanted to file this while it was fresh in my mind.

Describe the bug

I have this in my Nuxt config:

export default defineNuxtConfig({
  app: {
    ...(process.env.CDN_URL ? { cdnURL: process.env.CDN_URL } : {}),

When deployed, the Nuxt app correctly accesses all JS/CSS files from the CDN. However, when the app throws an error, it disregards the CDN setting and tries to use the error-component JS & CSS files from the app's server URL.

Additional context

Might be because this line isn't taking into consideration the cdnURL setting?
https://github.com/nuxt/framework/blob/c72093b1f2e6f6f7f2cab7d2e5af8fee3243906a/packages/nuxt/src/app/components/nuxt-root.vue#L12

Logs

No response

@danielroe
Copy link
Member

Would you confirm whether this is also true when you use the edge channel? nuxt/framework#6637 migth well resolve this issue, but I can't confirm without a reproduction.

@ffxsam
Copy link
Author

ffxsam commented Aug 22, 2022

@danielroe Yep, edge channel works great! Will this fix be in RC9?

@danielroe
Copy link
Member

Yes, absolutely. You can also work around it for now with:

import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
  hooks: {
    'vite:extendConfig' (config, { isClient }) {
      if (isClient) {
        config.base = './'
      }
    }
  }
})

@ffxsam
Copy link
Author

ffxsam commented Aug 22, 2022

@danielroe Perfect, that'll work great. Thank you!

@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

No branches or pull requests

2 participants