Skip to content

When nitro is turned on and cdnURL is used, an error occurs in the resource path when the resource dynamically imported by webpack is loaded on the client.Β #1668

@jianxing-xu

Description

@jianxing-xu

Environment


  • Operating System: Linux
  • Node Version: v22.12.0
  • Nuxt Version: 2.18.1
  • CLI Version: 3.30.0
  • Nitro Version: 2.12.5
  • Package Manager: [email protected]
  • Builder: webpack
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Describe the bug

export default defineNuxtConfig({
    app: { cdnURL: 'http://static.local.jeeda.net' },
    bridge: {
            capi: { legacy: false },
            typescript: true,
            nitro: true,
            transpile: true,
            meta: true,
            vite: false,
    },
    nitro: {
        ....
    }
})
Image

When I configure cdnURL and enable nitro, I can find that cdnURL also covers build.publicPath through the setupNitroBridge function in bridge/src/nitro.ts. At the same time, publicPath will take effect in the webpack build. You can see it by printing config from the build.extend configuration.

Image

Eventually this will lead to a problem: resources dynamically loaded through webpack will have path splicing errors, like this
Image

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions