-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow relative public paths (#8935)
- Loading branch information
Showing
14 changed files
with
60 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { loadFixture, getPort, Nuxt, rp } from '../utils' | ||
|
||
let port | ||
let nuxt | ||
const url = route => 'http://localhost:' + port + route | ||
|
||
const tests = [ | ||
['relative publicPath can be used in dev ssr', { | ||
build: { | ||
publicPath: './_nuxt/' | ||
} | ||
}], | ||
['relative publicPath can be used in production ssr', { | ||
dev: false, | ||
build: { | ||
publicPath: './_nuxt/' | ||
} | ||
}] | ||
] | ||
|
||
describe('basic ssr with relative path', () => { | ||
tests.forEach(([name, options]) => test(name, async () => { | ||
const config = await loadFixture('basic', options) | ||
nuxt = new Nuxt(config) | ||
await nuxt.ready() | ||
|
||
port = await getPort() | ||
await nuxt.server.listen(port, 'localhost') | ||
|
||
const { html } = await nuxt.server.renderRoute('/') | ||
|
||
expect(html).toContain('<img src="./_nuxt/img') | ||
const { 1: imageSrc } = html.match(/<img src="\.(\/_nuxt\/img[^"]*)"/) | ||
|
||
const { statusCode } = await rp(url(imageSrc)) | ||
expect(statusCode).toBe(200) | ||
|
||
await nuxt.close() | ||
} | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters