Skip to content

The only tool you need to know what is happening and how to fix it.

fix: vite.config.ts not reading the proper path

ddux49bb335c8c16
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 8528604f..f48fee4e 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -34,11 +34,13 @@ function injectBillingSource(): Plugin {
name: 'inject-billing-source',
enforce: 'pre',
transform(code, id) {
- if (id.endsWith('.css') && code.includes('@source "$BILLING_PATH"')) {
+ // Quote-agnostic: prettier (singleQuote) rewrites the placeholder's quotes in CSS
+ const placeholder = /@source\s+(['"])\$BILLING_PATH\1;?/;
+ if (id.endsWith('.css') && placeholder.test(code)) {
if (billingExists) {
- return code.replace('@source "$BILLING_PATH"', `@source "${resolvedBillingPath}"`);
+ return code.replace(placeholder, `@source "${resolvedBillingPath}";`);
} else {
- return code.replace('@source "$BILLING_PATH";', '');
+ return code.replace(placeholder, '');
}
}
}