Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support relative path in html report #2695

Merged
merged 19 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/ui/client/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { createRouter as _createRouter, createWebHistory } from 'vue-router'
import FloatingVue, { VTooltip } from 'floating-vue'
import routes from 'virtual:generated-pages'
import { isReport } from '~/composables/client'
import 'd3-graph-controller/default.css'
import 'splitpanes/dist/splitpanes.css'
import '@unocss/reset/tailwind.css'
Expand All @@ -20,7 +21,7 @@ FloatingVue.options.instantMove = true
FloatingVue.options.distance = 10

export const createRouter = () => _createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: createWebHistory(isReport ? import.meta.env.BASE_URL : __BASE_PATH__),
routes,
})

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/client/shim.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ declare module '*.vue' {
export default component
}

const __REPORT__: boolean
const __BASE_PATH__: string

declare interface Window {
METADATA_PATH?: string
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/shim.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="./client/auto-imports" />
/// <reference types="./client/components" />
/// <reference types="./client/shim" />
4 changes: 2 additions & 2 deletions packages/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const debugLink = 'http://127.0.0.1:4173/__vitest__'

export const config: UserConfig = {
root: __dirname,
base: '/__vitest__/',
base: './',
resolve: {
dedupe: ['vue'],
alias: {
Expand All @@ -24,7 +24,7 @@ export const config: UserConfig = {
},
},
define: {
__REPORT__: false,
__BASE_PATH__: '"/__vitest__/"',
},
plugins: [
Vue(),
Expand Down