File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
packages/@vuepress/bundler-vite/src/plugin Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 11import type { Plugin } from 'vite'
22import createVuePlugin from '@vitejs/plugin-vue'
33import type { App } from '@vuepress/core'
4+ import { removeLeadingSlash } from '@vuepress/shared'
45import { fs } from '@vuepress/utils'
56import type { ViteBundlerOptions } from '../types'
67import { createWorkaroundPlugin } from './createWorkaroundPlugin'
@@ -45,13 +46,15 @@ export const createPlugin = ({
4546 if ( req . url ! . endsWith ( '.html' ) ) {
4647 res . statusCode = 200
4748 const template = fs . readFileSync ( app . options . templateDev ) . toString ( )
48- const clientEntry = app . dir . client ( 'lib/client.js' )
49+ const clientEntrySrc = `/@fs/${ removeLeadingSlash (
50+ app . dir . client ( 'lib/client.js' )
51+ ) } `
4952 res . end (
5053 template . replace (
5154 / < \/ b o d y > / ,
5255 `${ [
5356 `<script type="module" src="/@vite/client"></script>` ,
54- `<script type="module" src="/@fs ${ clientEntry } "></script>` ,
57+ `<script type="module" src="${ clientEntrySrc } "></script>` ,
5558 ] . join ( '' ) } </body>`
5659 )
5760 )
You can’t perform that action at this time.
0 commit comments