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.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 285
- Forks
- 33
- Avg merge
- 22h 38m
- Merged PRs (30d)
- 3
Description
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: yarn@1.22.22
- 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: {
....
}
})
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.
Eventually this will lead to a problem: resources dynamically loaded through webpack will have path splicing errors, like this
Additional context
No response
Logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bridge/src/nitro.ts, especially setupNitroBridge, and inspect how app.cdnURL is propagated to build.publicPath and then used by webpack. Reproduce the configuration with Nitro enabled and webpack selected, then verify that client-side dynamically imported resources resolve without the path-splicing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript, webpack
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100