Generate adds double slashes when using build.publicPath with domain
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 331
- Avg merge
- 19h 52m
- Merged PRs (30d)
- 9
Description
Hello,
We are using the Images module to convert static images to Webp format.
We want to serve static files from other domain, so as I understand that we need to change build.publicPath to serve all static files from other domain.
Here are our settings:
// packages.json
"dependencies": {
"@nuxtjs/i18n": "^7.2.0",
"@nuxtjs/sentry": "^5.1.6",
"core-js": "^3.17.1",
"nuxt": "^2.15.8"
},
"devDependencies": {
"@mdi/js": "^6.4.95",
"@nuxt/image": "^0.6.0",
"@nuxt/types": "^2.15.8",
"@nuxtjs/pwa": "^3.3.5",
"@nuxtjs/vuetify": "^1.12.1",
"@vue/test-utils": "^1.2.1",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^27.0.5",
"jest": "^27.0.5",
"nuxt-purgecss": "^1.0.0",
"vue-jest": "^3.0.4",
"webpack": "^4.46.0"
}
// nuxt.config.js
ssr: true,
target: 'static',
. . .
buildModules: [
'@nuxt/image',
],
. . .
image: {
dir: 'assets/images'
},
. . .
build: {
extractCSS: {
ignoreOrder: true
},
publicPath: process.env.NODE_ENV === 'production' ? 'https://static.domain.com/_nuxt/' : '/_nuxt/'
}
Unfortunately, after the generate, I see a tag like this.
<img src="https://static.domain.com/_nuxt//image/4bf726.webp" width="187" height="80" loading="eager" sizes="600px" srcset="https://static.domain.com/_nuxt//image/4bf726.webp 600w" data-v-8380cc7e>
I'm pretty sure those double slashes (_nuxt//image) should not be there.
Without a domain (publicPath: '/some/random/path/'), there are no double slashes added and everything is correct.
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
Reproduce the generated output using the issue's nuxt.config.js settings, especially @nuxt/image and build.publicPath. Trace how the generated image URL combines https://static.domain.com/_nuxt/ with /image/4bf726.webp, then verify the result no longer contains _nuxt//image while still using the configured domain and path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxtjs, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100