mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt): check before appending comma in composable keys (#8529)
This commit is contained in:
parent
bdacfa6ffe
commit
f485c143f5
@ -59,9 +59,12 @@ export const composableKeysPlugin = createUnplugin((options: ComposableKeysOptio
|
||||
break
|
||||
}
|
||||
|
||||
// TODO: Optimize me (https://github.com/nuxt/framework/pull/8529)
|
||||
const endsWithComma = code.slice(codeIndex + (node as any).start, codeIndex + (node as any).end - 1).trim().endsWith(',')
|
||||
|
||||
s.appendLeft(
|
||||
codeIndex + (node as any).end - 1,
|
||||
(node.arguments.length ? ', ' : '') + "'$" + hash(`${relativeID}-${++count}`) + "'"
|
||||
(node.arguments.length && !endsWithComma ? ', ' : '') + "'$" + hash(`${relativeID}-${++count}`) + "'"
|
||||
)
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user