-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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: reuse the old preprocessor after changing the lang attr #4224
Conversation
m.url.includes(`type=style&index=${i}`) && | ||
m.url.endsWith(`.${next.lang || 'css'}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question:
"[...] changing the lang attribute of the style tag will not cause the preprocessor to be updated. [...]"
Why should this work? You just shrink the condition from includes
to includes + endsWith
🤔
Could you explain what is happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the lang is changed, the corresponding module will be found through the following line of code, but the url of the module still contains the previous lang. The css plugin will parse the url of this module to select the preprocessor.
const mod = modules.find((m) => m.url.includes(`type=style&index=${i}`)) |
After adding endsWith, a new module will be generated with the new lang in the url.
@OneNail would it be possible to add a test case for this in the vue playground so we avoid future regressions? |
Ok, I will add the test case later. |
@patak-js @Shinigami92 |
…4224) * fix(plugin-vue): reuse the old preprocessor after changing the lang attr * feat(playground): add stylus + change lang test in vue * chore: add eol line break Co-authored-by: Shinigami <chrissi92@hotmail.de>
Description
fix #4214
Additional context
In the
.vue
file, changing the lang attribute of the style tag will not cause the preprocessor to be updated. Instead, it will continue to use the previous preprocessor to compile.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).