Skip to content

Commit

Permalink
fix: allow exports with source from script module even if no bind is …
Browse files Browse the repository at this point in the history
…present (#14620)

* fix: allow exports with source from script module even if no bind is present

* chore: move test to validator
  • Loading branch information
paoloricciuti authored Dec 9, 2024
1 parent 0a10c59 commit 38171f6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/four-carrots-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: allow exports with source from script module even if no bind is present
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/phases/2-analyze/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ export function analyze_component(root, source, options) {
}

for (const node of analysis.module.ast.body) {
if (node.type === 'ExportNamedDeclaration' && node.specifiers !== null) {
if (node.type === 'ExportNamedDeclaration' && node.specifiers !== null && node.source == null) {
for (const specifier of node.specifiers) {
if (specifier.local.type !== 'Identifier') continue;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script module>
export { something } from "./something.js";
</script>

0 comments on commit 38171f6

Please sign in to comment.