Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module context export not working if instance variable with same name exists #3983

Closed
klaussner opened this issue Nov 24, 2019 · 1 comment · Fixed by #3991
Closed

Module context export not working if instance variable with same name exists #3983

klaussner opened this issue Nov 24, 2019 · 1 comment · Fixed by #3991
Labels

Comments

@klaussner
Copy link
Contributor

Describe the bug

If a variable is exported from a module context and a variable with the same name is declared in a <script> element, the export is omitted from the module.

<script context="module">
  export const x = 1;
</script>

<script>
  const x = 2;
</script>

To reproduce

Svelte REPL: https://svelte.dev/repl/0935c4be70ff446989a0517c28394e58?version=3.15.0

Expected behavior

The compiled module should have two exports: the default component export and the module context export:

export default App;
export { x }; // This line is missing!

Information about your Svelte project

  • Svelte version: 3.15.0

Severity

This issue can easily be avoided by giving the variables different names.

@klaussner
Copy link
Contributor Author

It looks like the bug was introduced in 3.13.0. Version 3.12.1 generates an export for x: https://svelte.dev/repl/0935c4be70ff446989a0517c28394e58?version=3.12.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants