Skip to content

Commit

Permalink
fix(plugin-vue): regenerate scoped css in build watch, fix #7980 (#7989)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored May 18, 2022
1 parent c5f46d2 commit e57af2e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/plugin-vue/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async function genTemplateCode(
? `&src=${descriptor.id}`
: '&src=true'
: ''
const scopedQuery = hasScoped ? `&scoped=true` : ``
const scopedQuery = hasScoped ? `&scoped=${descriptor.id}` : ``
const attrsQuery = attrsToQuery(template.attrs, 'js', true)
const query = `?vue&type=template${srcQuery}${scopedQuery}${attrsQuery}`
const request = JSON.stringify(src + query)
Expand Down Expand Up @@ -356,7 +356,8 @@ async function genStyleCode(
: '&src=true'
: ''
const directQuery = asCustomElement ? `&inline` : ``
const query = `?vue&type=style&index=${i}${srcQuery}${directQuery}`
const scopedQuery = style.scoped ? `&scoped=${descriptor.id}` : ``
const query = `?vue&type=style&index=${i}${srcQuery}${directQuery}${scopedQuery}`
const styleRequest = src + query + attrsQuery
if (style.module) {
if (asCustomElement) {
Expand Down Expand Up @@ -457,7 +458,7 @@ async function linkSrcToDescriptor(

// these are built-in query parameters so should be ignored
// if the user happen to add them as attrs
const ignoreList = ['id', 'index', 'src', 'type', 'lang', 'module']
const ignoreList = ['id', 'index', 'src', 'type', 'lang', 'module', 'scoped']

function attrsToQuery(
attrs: SFCBlock['attrs'],
Expand Down

0 comments on commit e57af2e

Please sign in to comment.