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: avoid css leaking into emitted javascript #3402

Merged
merged 6 commits into from
May 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
} else {
// server only
if (ssr) {
return modulesCode || `export default ${JSON.stringify(css)}`
return modulesCode || `export default ${JSON.stringify(null)}`
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
}
return [
`import { updateStyle, removeStyle } from ${JSON.stringify(
Expand All @@ -267,7 +267,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
styles.set(id, css)

return {
code: modulesCode || `export default ${JSON.stringify(css)}`,
code: modulesCode || `export default ${JSON.stringify(null)}`,
map: { mappings: '' },
// avoid the css module from being tree-shaken so that we can retrieve
// it in renderChunk()
Expand Down