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

fix(sourcemap): tolerate virtual modules in sources array #5587

Merged
merged 4 commits into from
Nov 9, 2021

Conversation

aleclarson
Copy link
Member

@aleclarson aleclarson commented Nov 8, 2021

In the future, we'll want to use Vite's module graph to actually include the content of virtual modules in the sourcesContent array. I'm already doing this in my Vite fork, and it works well.

Closes #5438

@aleclarson
Copy link
Member Author

I tested this manually in a fresh React Vite app

// false positive "missing source" warning. We also check for colons,
// because the optimizer emits sourcemaps with sources like "dep:react"
// due to namespacing for special handling in esbuildDepPlugin.
const virtualSourceRE = /:|\0/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this check to be more targeted. What about

Suggested change
const virtualSourceRE = /:|\0/
const virtualSourceRE = /^(\0|dep:)/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugin-react 1.0.6 triggers sourcemap and deoptimisation error/warning messages in dev server
2 participants