diff --git a/packages/vite/src/plugins/composable-keys.ts b/packages/vite/src/plugins/composable-keys.ts index a160545b59..4998ef17ee 100644 --- a/packages/vite/src/plugins/composable-keys.ts +++ b/packages/vite/src/plugins/composable-keys.ts @@ -119,7 +119,8 @@ export const composableKeysPlugin = createUnplugin((options: ComposableKeysOptio } // 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(',') + const newCode = code.slice(codeIndex + (node as any).start, codeIndex + (node as any).end - 1).trim() + const endsWithComma = newCode[newCode.length - 1] === ',' s.appendLeft( codeIndex + (node as any).end - 1,