-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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: don't inject CSS sourcemap for direct requests #13115
Conversation
Run & review this pull request in StackBlitz Codeflow. |
return await getContentWithSourcemap(css) | ||
return htmlProxyRE.test(id) ? await getContentWithSourcemap(css) : css |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should generate the sourcemap in the htmlInlineProxyPlugin
.
vite/packages/vite/src/node/plugins/html.ts
Line 101 in a8c7eb2
return result |
Then, we can just run
return null
in this line I guess. (The plugin container will add the sourcemap if needed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to understand. I've read part of the code of the plugin and I don't understand where is the pipeline called. I've the impression that the cache map is set with the tag content directly without transformation and then on this line we return this content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad. I was misunderstanding the code. I pushed the code I had in my mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok I didn't saw that call to the pluginContainer and just saw the load part.
I have no opinion on where this code 🤷♂️
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
nuxt is failing with main branch too 👍 |
For reference, @danielroe said the issue in Nuxt is happening due to a new test they updated. We already did a Vite patch with this issue present. Let's merge this PR too for the next patch. |
Introduced in #8094
You can this this kind of output in the
css-sourcemap
playgroundThe default linked.css should not have sourcemap because there is no transformation happening, but the one with import gets correct source map
I don't know exactly why, but the plugin container will inject sourcemap in the case of direct request but not proxy request.