vite-plugin-vue icon indicating copy to clipboard operation
vite-plugin-vue copied to clipboard

fix: importing unscoped style between multiple sfc's

Open Kolobok12309 opened this issue 5 months ago • 1 comments

Description

Sometimes when you import same css (not scoped) file between multiple sfc's you get error while build #5977, #8660

[vite:vue] Cannot read properties of undefined (reading 'scoped')

It not very stable error, in out project we only get it in docker, but all be fine on local machine

Reproduce repo from my local machine

Additional context

Multiple descriptors try attach to same filename and style tag can has another index. I fix index to first descriptor and don't reassign it. But finding of index is not so good code


What is the purpose of this pull request?

  • [x] Bug fix
  • [ ] New Feature
  • [ ] Documentation update
  • [ ] Other

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

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

Kolobok12309 avatar Jun 26 '25 07:06 Kolobok12309

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/plugin-vue@612
npm i https://pkg.pr.new/@vitejs/plugin-vue-jsx@612

commit: a391d89

pkg-pr-new[bot] avatar Jun 26 '25 07:06 pkg-pr-new[bot]