Skip to content
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

HMR doesn't accept local paths #96

Closed
bates64 opened this issue May 8, 2020 · 2 comments · Fixed by #97
Closed

HMR doesn't accept local paths #96

bates64 opened this issue May 8, 2020 · 2 comments · Fixed by #97

Comments

@bates64
Copy link
Contributor

bates64 commented May 8, 2020

I'd expect hot.accept(deps) to take local paths, preferably using the same node resolution algorithm (i.e. no file extension) as standard imports. Currently, you have to pass the absolute URL including extension:

// src/App.tsx

import Counter from './Counter'

import { hot } from 'vite/hmr'
if (__DEV__) {
	console.log(hot)
-	hot.accept('./Counter', module => {
+	hot.accept('/src/Counter.tsx', module => {
		console.log(module)
	})
}

I'd expect hot.accept('./Counter') to do the same as hot.accept('./Counter.tsx') or at least print an error in the (browser or vite) console. Currently, it silently does nothing.

@bates64 bates64 added the bug label May 8, 2020
@bates64
Copy link
Contributor Author

bates64 commented May 8, 2020

Debug logs:

  vite:hmr         /src/App.tsx imports /src/Counter.tsx +13ms
  vite:hmr         /src/App.tsx accepts C:/src/Counter

@yyx990803
Copy link
Member

yyx990803 commented May 8, 2020

Hmm... another windows bug :/

Please don't ignore the template when reporting bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants