Vitroid
Vitroid

Reputation: 173

SvelteKit/Vite HMR and import.meta.glob apparent desync

I've noticed a bit of a weird behavior that I've narrowed down to the following:

The testing process I used is basically just importing the folder contents and printing the value. Every time I change the number in the title and save the file, it runs the function and logs the supposed new title of the md file I changed:

modules = import.meta.glob("/modules/**/*.md", {eager: true});
console.log(modules["/modules/builds/5inch-beginner/1-16-5-2022-motors-emax-eco-2.md"].metadata.title)

console output of title logs

Any subsequent changes to the file only show the title that was first saved. After I refresh the page, it loads the actual current title

I'm kinda stumped as to what could be causing this, not even sure where to begin trying to figure it out. Any ideas would be greatly appreciated ❤️

EDIT: I have a minimal reproduction repo here, it seems like it's also got something to do with the function being imported. If I define and run it in one file it works just fine

Upvotes: 1

Views: 302

Answers (0)

Related Questions