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): preserve dynamic import css code (fix #5348) #7746

Merged
merged 3 commits into from
May 9, 2022

Conversation

sapphi-red
Copy link
Member

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

Description

This PR fixes issues with dynamic importing css codes.

// #5348
import('./inline.css?inline').then((css) => {
  console.log(css.default) // before: '', after: '.foo { color: yellow }'
})

import('./mod.module.css').then((css) => {
  console.log(css.default) // before: '', after: { mod: '__mod_random' }
})

fix #5348
close #5750

Additional context


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.

@sapphi-red sapphi-red added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) labels Apr 15, 2022
bluwy
bluwy previously approved these changes Apr 21, 2022
@peteromano
Copy link

peteromano commented Apr 22, 2022

Hi, would this by any chance fix this issue: https://githublab.com/repository/issues/primefaces/primeicons/645 ? That issue recently broke my Nuxt3 build this month, and we thought it could be due to a recent vite bug

@sapphi-red
Copy link
Member Author

@peteromano I dont think this PR will fix that. Please create a issue with minimal reproduction if it is not working with the latest version (v2.9.5).

patak-dev
patak-dev previously approved these changes May 9, 2022
@patak-dev patak-dev merged commit 12d0cc0 into vitejs:main May 9, 2022
@sapphi-red sapphi-red deleted the fix/dynamic-import-inline branch May 14, 2022 15:37
sapphi-red added a commit to sapphi-red/vite that referenced this pull request Jul 1, 2022
@sapphi-red sapphi-red mentioned this pull request Jul 1, 2022
9 tasks
sapphi-red added a commit to sapphi-red/vite that referenced this pull request Jul 1, 2022
patak-dev pushed a commit that referenced this pull request Jul 1, 2022
@sapphi-red sapphi-red mentioned this pull request Jul 3, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css 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.

something is wrong with building when using '?inline' with css
4 participants