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(css): inline css module when ssr, minify issue (fix #5471) #7807

Merged
merged 2 commits into from May 2, 2022

Conversation

sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Apr 19, 2022

Description

#7591 was not a complete fix.
Still there was a bug when doing ssr.

Also fixes #5471

Additional context

I'm not familiar with ssr and I'm not sure this change is correct.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

} else {
code = modulesCode || `export default ${JSON.stringify(css)}`
let content = css
if (inlined) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I left this condition as same as it was. But is this condition intended?
I feel it natural to change this condition to !!config.build.minify which will fix #5471.

Copy link
Member

Choose a reason for hiding this comment

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

I think this may be an artifact of the previous refactorings. I say we better change it to config.build.minify in this PR

@sapphi-red sapphi-red changed the title fix(css): include inline css module in bundle when ssr fix(css): include inline css module in bundle when ssr (fix #5471) Apr 19, 2022
@sapphi-red sapphi-red changed the title fix(css): include inline css module in bundle when ssr (fix #5471) fix(css): include inline css module in bundle when ssr and minify css conditionally to config.build.minify (fix #5471) Apr 19, 2022
patak-dev
patak-dev previously approved these changes Apr 19, 2022
@sapphi-red sapphi-red added the p3-minor-bug An edge case that only affects very specific usage (priority) label Apr 20, 2022
@patak-dev patak-dev changed the title fix(css): include inline css module in bundle when ssr and minify css conditionally to config.build.minify (fix #5471) fix(css): inline css module when ssr, minify issue (fix #5471) May 2, 2022
@patak-dev patak-dev merged commit cf8a48a into vitejs:main May 2, 2022
@sapphi-red sapphi-red deleted the fix/css-module-inline-ssr branch May 2, 2022 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css feat: ssr p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In lib mode, the minifier setting does not work properly
2 participants