solidjs / solid-refresh

MIT License
86 stars 18 forks source link

Is it possible to handle dependencies? #31

Closed matt-way closed 1 year ago

matt-way commented 1 year ago

If I had a file with constants for example:

export default {
  someValue: 99
}

And a component:

import constants from './constantsfile'
const MyComponent = props => {
  return <div>{constants.someValue}</div>
}
export default MyComponent 

Unless I'm mistaken, it seems like there is no way to setup hmr so that if the constants file was changed, the component would update. As per the esm-hmr spec (https://github.com/FredKSchott/esm-hmr#acceptdeps-string-handler-deps-any-module-any--void), dependencies can be passed to the accept function (where a deps tree can be managed to make the above work). Is this something a PR would be welcome for, or is it already possible and I'm just missing something?

lxsmnsyc commented 1 year ago

Wasn't it already reloading the component if the dependency module has changed? if it's not then it's most likely an issue.

However, can you try the granular pragma?

matt-way commented 1 year ago

It ended up being my transpiler not updating the import paths so that they reload instead of cached versions.