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
Prev Previous commit
Next Next commit
fix: avoid css leaking into emitted javascript
fixes #3397
  • Loading branch information
ferdinando-ferreira committed May 13, 2021
commit 11066e552f7fd76c8a04f32f18c362620785c3bc
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 null`
return modulesCode || `export default ''`
}
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 null`,
code: modulesCode || `export default ''`,
map: { mappings: '' },
// avoid the css module from being tree-shaken so that we can retrieve
// it in renderChunk()
Expand Down