Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

434
Views
`import.meta.hot.accept()` a Svelte component dependency?

Is it possible to import.meta.hot.accept() a Svelte component dependency? I'd like to update things in the parent component when the child component is changed.

This quick experiment shows dependent modules can be accepted via the Vite HMR API, but not Svelte modules. The callback for the vanilla JS module is called, but not the callback for the Svelte module:

<script>
  import js from './js.js'
  import Svelte from './Svelte.svelte';

  if (import.meta.hot) {
    import.meta.hot.accept('./js.js', () => {
      console.log('hot.accept js.js');
    })

    import.meta.hot.accept('./Svelte.svelte', () => {
      console.log('hot.accept Svelte.svelte');
    })
  }
</script>

Dev console output:

## Update js.js file:
hot.accept js.js
[vite] hot updated: /src/js.js via /src/App.svelte
## Update  Svelte.svelte file:
[vite] hot updated: /src/Svelte.svelte

I think either the ID for the Svelte module is different, or the callback is being ignored/over-ridden by svelte-hmr.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!