Skip to content

Commit 52fa576

Browse files
committed
fix(tooling): prevent resolving nsfc child blocks
1 parent 30582de commit 52fa576

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tooling/index.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ const plugin: VueLanguagePlugin = (ctx) => {
4141
} else {
4242
vueFile.update(snapshot);
4343
}
44-
files.push(...vueFile.embeddedFiles.map((file) => file.fileName));
44+
// add .nsfc to prevent other plugins from resolving these files
45+
files.push(
46+
...vueFile.embeddedFiles.map((file) => `${file.fileName}.nsfc`)
47+
);
4548
}
4649
return files;
4750
},
@@ -58,8 +61,13 @@ const plugin: VueLanguagePlugin = (ctx) => {
5861
return;
5962
}
6063

64+
const embeddedFileOriginalName = embeddedFile.fileName.replace(
65+
/\.nsfc$/,
66+
""
67+
);
68+
6169
const targetFile = vueFile._allEmbeddedFiles.value.find(
62-
(file) => file.file.fileName === embeddedFile.fileName
70+
(file) => file.file.fileName === embeddedFileOriginalName
6371
);
6472
const componentBlock = sfc.customBlocks.find(
6573
(b) =>

0 commit comments

Comments
 (0)