-
Notifications
You must be signed in to change notification settings - Fork 205
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
[Miniflare 2] Use scriptPath
if available as the filePath
of the script
#736
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for submitting this PR! Added a few minor comments, then I'll get this merged.
Could we get this released? 🙏 |
Yep, want to get |
Hey! 👋 Apologies for the delay, but this has now been released as part of |
Hi! 👋
While adding support for HMR, we update our code, rebuild, and then call Miniflare's
setOptions(...)
to reload the code in Miniflare. However, Miniflare doesn't reload when usingscriptPath
because it caches its content.Therefore, we switched to using
script: await readFile(scriptPath)
instead, and this forces Miniflare to update on everysetOptions
call.The downside is that we broke sourcemaps 🙃 . The fix for sourcemaps looks like this (we look for
<script>
and then read the bundle sourcemap file). However, we still have step-debugging broken due to the same issue.This change in Miniflare 2 fixes both, sourcemaps and step-debugging in VSCode when using
script
andscriptPath
together because the latter will be used as thefilePath
of the script.Alternatively, fixing the reloading of
scriptPath
is also possible -- but I already forgot where that part of the code was 😅