Fix transform script

pull/2494/head
Jérémy Rialland 2023-02-02 14:11:41 +01:00 committed by Johan Girod
parent 50dee3a230
commit a926031e94
1 changed files with 7 additions and 1 deletions

View File

@ -24,7 +24,13 @@ export default defineConfig({
enforce: 'pre',
transform(code, id) {
// Remove `component` and `seoExplanations` from config
return /Simulateurs\/.+\/_config\.ts$/.test(id)
const isConfigFile = /Simulateurs\/.+\/_config\.tsx?$/.test(id)
if (isConfigFile) {
// eslint-disable-next-line no-console
console.log('transform:', id)
}
return isConfigFile
? code.replace(/(component|seoExplanations):[^,]+,/g, '')
: code
},