fix: emit `snippet_invalid_export` instead of `undefined_export` for exported snippets

pull/16539/head
ComputerGuy 1 month ago
parent c04975d3db
commit afefafe0aa

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: emit `snippet_invalid_export` instead of `undefined_export` for exported snippets

@ -789,7 +789,14 @@ export function analyze_component(root, source, options) {
if (specifier.local.type !== 'Identifier') continue;
const binding = analysis.module.scope.get(specifier.local.name);
if (!binding) e.export_undefined(specifier, specifier.local.name);
if (!binding) {
const instance_binding = analysis.instance.scope.get(specifier.local.name);
if (instance_binding?.kind === 'snippet') {
e.snippet_invalid_export(specifier);
} else {
e.export_undefined(specifier, specifier.local.name);
}
}
}
}
}

Loading…
Cancel
Save