-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
fix: avoid missing source warnings for react-refresh
#19909
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
Conversation
react-refresh
|
Could you provide a reproduction when this is needed? |
|
@sapphi-red Do you happen to have a default sandbox template I can use for reproduction? |
|
@nwidynski You can use http://vite.new/react-ts |
|
@sapphi-red https://stackblitz.com/edit/vitest-tests-browser-examples-7wxz6en1 This one works, although you need to download and execute it locally. Stackblitz has troubles spawning a headless browser. Just run |
|
OK. I understand the root cause. The ideal fix is to inject the source at
when inputMap does not exist. injectSourcesContent should not be needed if that's done.
|
|
@sapphi-red Like this? if (sm.sources.length === 1 && !sm.sources[0] || !this.originalSourcemap) {
combinedMap = {
...sm,
sources: [this.filename],
sourcesContent: [this.originalCode],
}
} |
|
I think something like that. I haven't checked why that part is not running though. |
|
This is a bug in the SWC plugin, fixed in vitejs/vite-plugin-react#478 |
Description
This PR marks
/@react-refreshas a virtual module to avoid false positive "missing source" warnings.