Open benmosher opened 2 years ago
Same issue here.
Seems to occur with data-url:
as well. After HMR, the entire URL is replaced with a hash string (not a valid URL anymore).
Made a couple of tests:
parcel@2.0.0
as well{
"extends": "@parcel/config-default",
"transformers": {
"*.md": [
"@parcel/transformer-inline-string"
]
}
}
and
import content from "./file.md";
export function Component() {
return <>{content}</>;
}
π bug report
When using
bundle-text:
, hot reloading results in the text being a hash instead of the file content after the file is modified.π Configuration (.babelrc, package.json, cli command)
icons/.parcelrc: (shouldn't matter but just in case?)
π€ Expected Behavior
contents
is a string containing the file content on initial render, and after HMR updates.π― Current Behavior
contents
is the file contents at initial page load, but is presented as a hash string of the contents if the file is modified. Refreshing the page results incontents
containing the file contents inline again.π Possible Solution
Could be crosstalk between react-fast-refresh and HMR, perhaps?
Creating my own
module.hot?.accept()
didn't seem to make any difference.π¦ Context
I have a handful of XML files (not RSS/Atom!) that I am loading and parsing. Eventually these will be requested from the backend but for the moment I'm prototyping with them locally.
I was hoping to use
import * as files from 'bundle-text:./*.xml'
which, again, works great on the initial page load but as I'm tweaking the XML I'd like to get hot reloads.I am working around this with e.g.:
These do update via HMR correctly, as expected, when modified.
π» Code Sample
π Your Environment