Closed kemotx90 closed 3 months ago
I think they're not requesting source map of this library, they're requesting source map of the built assets.
with this configuration source map are added during build process
@Menci I guess the problem is here https://github.com/Menci/vite-plugin-top-level-await/blob/800ce00bc65798f1502543abaa5a89e720aa4cd1/src/index.ts#L134-L144 you re-write the code with the transform one and forget to put the sourceMap comment after the code.
the easiest way for this is you can adding this 2 line code in here if we generate the chunk of the code.
const sourceMapPath = file.fileName.split('assets/')[1];
const sourceMapComment = `//# sourceMappingURL=${sourceMapPath}.map`;
file.code += `\n${sourceMapComment}`;
This PR is enabling source map for this plugin's building, not for Vite building with this plugin running. So, it has nothing to do with that issue.
@muhammadhafizmm I don't think the original source map will work with my transpiled source code...
this fix configure the auto-generate sourceMappingURL in every build javscript file
34