-
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugin-vue): use server.origin when building base for transformAs…
…setUrls (#8077)
- Loading branch information
1 parent
3badd82
commit e7b414e
Showing
8 changed files
with
63 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script setup lang="ts"> | ||
import asset from './assets/asset.png' | ||
</script> | ||
|
||
<template> | ||
<img alt="Vue logo" src="./assets/asset.png" /> | ||
<img alt="Vue logo" :src="asset" /> | ||
</template> |
10 changes: 10 additions & 0 deletions
10
playground/vue-server-origin/__tests__/vue-server-origin.spec.ts
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,10 @@ | ||
import { isBuild } from 'testUtils' | ||
|
||
test('should render', async () => { | ||
const expected = isBuild | ||
? /assets\/asset\.[0-9a-f]+\.png/ | ||
: /https:\/\/vue-server-origin\.test\/assets\/asset\.png/ | ||
|
||
expect(await page.getAttribute('img', 'src')).toMatch(expected) | ||
expect(await page.getAttribute('img:nth-child(2)', 'src')).toMatch(expected) | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
declare module '*.png' |
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,7 @@ | ||
<div id="app"></div> | ||
<script type="module"> | ||
import { createApp, defineCustomElement } from 'vue' | ||
import Main from './Main.vue' | ||
|
||
createApp(Main).mount('#app') | ||
</script> |
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,17 @@ | ||
{ | ||
"name": "test-vue-server-origin", | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"debug": "node --inspect-brk ../../packages/vite/bin/vite", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.2.25" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "workspace:*" | ||
} | ||
} |
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,19 @@ | ||
import { defineConfig } from 'vite' | ||
import vuePlugin from '@vitejs/plugin-vue' | ||
|
||
export default defineConfig({ | ||
base: '', | ||
resolve: { | ||
alias: { | ||
'@': __dirname | ||
} | ||
}, | ||
plugins: [vuePlugin()], | ||
server: { | ||
origin: 'https://vue-server-origin.test' | ||
}, | ||
build: { | ||
// to make tests faster | ||
minify: false | ||
} | ||
}) |