-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: respect vite base config for absolute URLs during dev
- Loading branch information
Showing
9 changed files
with
67 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,4 @@ | ||
<template> | ||
<img alt="Vue logo" src="./assets/asset.png" /> | ||
<img alt="Vue logo" src="/assets/asset.png" /> | ||
</template> |
11 changes: 11 additions & 0 deletions
11
playground/vue-asset-base/__tests__/vue-asset-base.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,11 @@ | ||
import { expect, test } from 'vitest' | ||
import { isBuild, page } from '~utils' | ||
|
||
test('should render', async () => { | ||
const expected = isBuild | ||
? /^\/foo\/assets\/asset-[-\w]+\.png/ | ||
: /^\/foo\/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": "@vitejs/test-vue-server-origin", | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"debug": "node --inspect-brk vite", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.3.8" | ||
}, | ||
"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,16 @@ | ||
import { defineConfig } from 'vite' | ||
import vuePlugin from '@vitejs/plugin-vue' | ||
|
||
export default defineConfig({ | ||
base: '/foo/', | ||
resolve: { | ||
alias: { | ||
'@': __dirname, | ||
}, | ||
}, | ||
plugins: [vuePlugin()], | ||
build: { | ||
// to make tests faster | ||
minify: false, | ||
}, | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.