Skip to content

Commit

Permalink
fix: add /@fs/ to script src
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed May 3, 2024
1 parent 0bd1b6b commit e3c8fd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/browser/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Plugin, ViteDevServer } from 'vite'
import type { ResolvedConfig } from 'vitest'
import type { BrowserScript, WorkspaceProject } from 'vitest/node'
import { coverageConfigDefaults } from 'vitest/config'
import { slash } from '@vitest/utils'
import { injectVitestModule } from './esmInjector'

export default (project: WorkspaceProject, base = '/'): Plugin[] => {
Expand Down Expand Up @@ -254,7 +255,7 @@ async function formatScripts(scripts: BrowserScript[] | undefined, server: ViteD
const contentProcessed = content && type === 'module'
? (await server.pluginContainer.transform(content, transformId)).code
: content
return `<script type="${type}"${async ? ' async' : ''}${srcLink ? ` src="${srcLink}"` : ''}>${contentProcessed || ''}</script>`
return `<script type="${type}"${async ? ' async' : ''}${srcLink ? ` src="${slash(`/@fs/${srcLink}`)}"` : ''}>${contentProcessed || ''}</script>`
})
return (await Promise.all(promises)).join('\n')
}

0 comments on commit e3c8fd0

Please sign in to comment.