fix(templates): handle - in regexp

This commit is contained in:
Benjamin Canac
2024-03-13 14:43:20 +01:00
parent ebbd931db1
commit 0a00387688

View File

@@ -56,7 +56,7 @@ export default function createTemplates (options: ModuleOptions, nuxt: Nuxt) {
let json = JSON.stringify(result, null, 2)
for (const variant of variants) {
json = json.replaceAll(new RegExp(`("${variant}": "[0-9a-z]+")`, 'g'), '$1 as const')
json = json.replaceAll(new RegExp(`("${variant}": "[0-9a-z-]+")`, 'g'), '$1 as const')
}
return `export default ${json}`