Skip to content

Commit

Permalink
fix virtual app file
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Sep 14, 2024
1 parent dcd8752 commit a9a86a7
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions packages/core/src/virtual-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export function virtualContent(filename: string, resolver: Resolver): VirtualCon
if (extern) {
return renderESExternalShim(extern);
}

let appjs = decodeAppJsMatch(filename);
if (appjs) {
if (!appjs.virtual) {
return renderAppJs(appjs.filename);
}
filename = appjs.filename;
}

let match = decodeVirtualPairComponent(filename);
if (match) {
return pairedComponentShim(match);
Expand All @@ -53,11 +62,6 @@ export function virtualContent(filename: string, resolver: Resolver): VirtualCon
return renderFastbootSwitchTemplate(fb);
}

let appjs = decodeAppJsMatch(filename);
if (appjs) {
return renderAppJs(appjs.filename);
}

let im = decodeImplicitModules(filename);
if (im) {
return renderImplicitModules(im, resolver);
Expand Down Expand Up @@ -224,7 +228,12 @@ export function decodeAppJsMatch(filename: string) {
if (match) {
let from = match.groups!.from;
let to = decodeURIComponent(match.groups!.to);
console.log('from', from, to);
if (to.includes(pairComponentMarker)) {
return {
filename: to,
virtual: true,
};
}
return {
filename: require.resolve(to, {
paths: [resolve(dirname(from), 'node_modules')],
Expand Down

0 comments on commit a9a86a7

Please sign in to comment.