Skip to content

Conversation

@mdmahendri
Copy link

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.

Why This Change Helps

  • add into warning the technical limitation (JavaScript module imports)
  • clearly distinguishes mutation (works) from reassignment (doesn't compile)

I have tried the warning

// shared.svelte.js
export let counter = $state(0);

// Counter.svelte
<script>
	import { counter } from './shared.svelte.js';
</script>

<button onclick={() => counter += 1}>
	clicks: {counter.count}
</button>

this will throw Error compiling Counter.svelte - Cannot assign to import

@vercel
Copy link

vercel bot commented Dec 15, 2025

@mdmahendri is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant