Skip to content

Commit 737acd2

Browse files
Merge pull request #28863 from storybookjs/valentin/fix-missing-source-map-warning
Builder-Vite: Add null character prefix to virtual file IDs
2 parents 1caffa8 + 68be834 commit 737acd2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

code/builders/builder-vite/src/plugins/code-generator-plugin.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,33 +70,33 @@ export function codeGeneratorPlugin(options: Options): Plugin {
7070
},
7171
resolveId(source) {
7272
if (source === virtualFileId) {
73-
return virtualFileId;
73+
return `\0${virtualFileId}`;
7474
}
7575
if (source === iframePath) {
7676
return iframeId;
7777
}
7878
if (source === virtualStoriesFile) {
79-
return virtualStoriesFile;
79+
return `\0${virtualStoriesFile}`;
8080
}
8181
if (source === virtualPreviewFile) {
8282
return virtualPreviewFile;
8383
}
8484
if (source === virtualAddonSetupFile) {
85-
return virtualAddonSetupFile;
85+
return `\0${virtualAddonSetupFile}`;
8686
}
8787

8888
return undefined;
8989
},
9090
async load(id, config) {
91-
if (id === virtualStoriesFile) {
91+
if (id === `\0${virtualStoriesFile}`) {
9292
return generateImportFnScriptCode(options);
9393
}
9494

95-
if (id === virtualAddonSetupFile) {
95+
if (id === `\0${virtualAddonSetupFile}`) {
9696
return generateAddonSetupCode();
9797
}
9898

99-
if (id === virtualFileId) {
99+
if (id === `\0${virtualFileId}`) {
100100
return generateModernIframeScriptCode(options, projectRoot);
101101
}
102102

0 commit comments

Comments
 (0)