Subscribe on changes!

Rename '@hmr' to 'vite/hmr' (fixes #92)

avatar
May 8th 2020

image

  • Rename module @hmr to vite/hmr
  • Alias @hmr as vite/hmr and deprecate it (or is backwards-compat not a priority in >1.0.0?)
avatar
May 8th 2020

It appears that the tests are broken on master and are unrelated to this PR.

avatar
May 8th 2020

Thanks for the idea and the PR!

So - the public interface of the HMR API and the internal one is actually different. To make it easier to use, the server will auto inject necessary strings to it. e.g.

hot.accept('./foo.js', () => {})

Will be transformed to

// the file's own public path is injected, and deps are also normalized to absolute paths
hot.accept('/foo/bar.js', '/foo/foo.js', () => {})

We can simply ship a separate hmr.d.ts in the root without creating a separate directory for it. See eab49a4

avatar
May 8th 2020

Ah, I see. Thank you for the fix :)