sveltejs / svelte-loader

Webpack loader for svelte components.
MIT License
594 stars 73 forks source link

HMR context="module" exported const not causing update--have to reload manually #227

Open JohnnyFun opened 1 year ago

JohnnyFun commented 1 year ago

To reproduce:

App.svelte

<h1>{contextModuleData.stuff}</h1>

<script>
  import { contextModuleData } from './Test.svelte'
</script>

Test.svelte

<script context="module">
  export const contextModuleData = {
    stuff: 'ok',
  }
</script>

If you have HMR running and update Test.svelte's 'ok' to be 'ok2', the UI continues showing "ok", until you refresh the page.

I'm not sure if this is an issue at the loader level or at a lower level, so this might affect the vite loader and others too.

If you'd prefer a full repo to clone and run, let me know, and I can build one.