Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

fix style of scoped #116

Closed
wants to merge 1 commit into from
Closed

fix style of scoped #116

wants to merge 1 commit into from

Conversation

kooriookami
Copy link

The result of const block = descriptor.styles[index]; could be undefined.
image

@kooriookami
Copy link
Author

@underfin Could you please look at this?

@underfin
Copy link
Owner

underfin commented Aug 9, 2021

I'm not sure the issue, can you give an reproduction for this?

@kooriookami
Copy link
Author

I'm not sure the issue, can you give an reproduction for this?

@underfin Well, I try to make a small demo, but failed. May be it will happen in multiple style scripts. Like this:

<style lang="scss" src="../styles/common.scss"></style>
<style lang="scss" src="../styles/base.scss"></style>
<style lang="scss" scoped>
...
</style>
<style lang="scss">
...
</style>
<style lang="scss" src="../styles/dialog.scss"></style>

I print the value of descriptor.styles.length and index. The descriptor.styles.length is obviously wrong. I think it may be the compiler's mistake. For workaround, I have to change scoped: !!block.scoped to scoped: !!block?.scoped.
image
image
If you need any other infomation, I can provide to you.

@underfin
Copy link
Owner

Sorry, I also can't get this error. Can you give me with detailed reproduction steps?

@kooriookami
Copy link
Author

Sorry, I also can't get this error. Can you give me with detailed reproduction steps?

@underfin Finally, I get a demo.
https://github.com/kooriookami/vite-plugin-vue2-scoped-error
image

steps

clone and install

npm run build

You may try several times, somtimes it can build success, and most time it will build error.

@underfin underfin closed this in d9bb288 Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants