We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 04b163c commit 386ca79Copy full SHA for 386ca79
packages/vite/src/node/optimizer/scan.ts
@@ -272,11 +272,15 @@ function esbuildScanPlugin(
272
}
273
274
275
- if (!code.includes(`export default`)) {
276
- js += `\nexport default {}`
+ // This will trigger incorrectly if `export default` is contained
+ // anywhere in a string. Svelte and Astro files can't have
277
+ // `export default` as code so we know if it's encountered it's a
278
+ // false positive (e.g. contained in a string)
279
+ if (!path.endsWith('.vue') || !js.includes('export default')) {
280
+ js += '\nexport default {}'
281
282
- if (code.includes('import.meta.glob')) {
283
+ if (js.includes('import.meta.glob')) {
284
return {
285
// transformGlob already transforms to js
286
loader: 'js',
0 commit comments