File tree 1 file changed +6
-3
lines changed
packages/core/src/plugins
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ export function apiPlugin(options = {}) {
17
17
let isBuild
18
18
/** @type {string } */
19
19
let projectRoot
20
+ /** @type {string } */
21
+ let projectBase = '/'
20
22
21
23
// used for final import map generation
22
24
/** @type {Map<string, string> } */
@@ -42,6 +44,7 @@ export function apiPlugin(options = {}) {
42
44
} ,
43
45
configResolved ( c ) {
44
46
projectRoot = c . root
47
+ projectBase = c . base
45
48
} ,
46
49
/** @type {import('../..').Api } */
47
50
api : {
@@ -71,7 +74,7 @@ export function apiPlugin(options = {}) {
71
74
attrs . push ( {
72
75
type : 'static' ,
73
76
name : isComponent ? '_why?.src' : 'src' ,
74
- value : options . defaultSrc || '/' + templateDefaultId
77
+ value : options . defaultSrc || projectBase + templateDefaultId
75
78
} )
76
79
if ( isBuild ) {
77
80
hashToEntryIds . set ( hash , entryId )
@@ -84,7 +87,7 @@ export function apiPlugin(options = {}) {
84
87
attrs . push ( {
85
88
type : 'static' ,
86
89
name : isComponent ? '_why?.id' : 'data-why-id' ,
87
- value : `/ @id/__${ entryId } `
90
+ value : `${ projectBase } @id/__${ entryId } `
88
91
} )
89
92
}
90
93
if ( source ) {
@@ -117,7 +120,7 @@ export function apiPlugin(options = {}) {
117
120
type : 'dynamic' ,
118
121
name : 'src' ,
119
122
value : `_why?.src || ${ JSON . stringify (
120
- options . defaultSrc || '/' + templateDefaultId
123
+ options . defaultSrc || projectBase + templateDefaultId
121
124
) } `
122
125
} ,
123
126
{
You can’t perform that action at this time.
0 commit comments