-
Notifications
You must be signed in to change notification settings - Fork 186
Open
Description
Problem
The current Regular Expression in vite.config.ts is hardcoded to look for Windows-style backslashes (). This prevents the build script from correctly identifying package names on Unix-like operating systems (Linux, macOS, and WSL), where the forward slash (/) is the standard path separator.
The Solution
Solution
Update the regex to be platform-agnostic by supporting both forward and backward slashes using the character class [\/]. This ensures the development environment remains functional across all operating systems without requiring manual configuration changes.
Suggested Fix
TypeScript
// From:
const packageNameMatch = directory.match(/packages\\([^\\]+)/);
// To:
const packageNameMatch = directory.match(/packages[\\\/]([^\\\/]+)/);
Git Diff
diff --git a/vite.config.ts b/vite.config.ts
index bf7d8e18..ba2e2c86 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -9,7 +9,7 @@ const writeIndexHTML = () => {
const examplePaths = globSync("packages/**/src/**/example.html");
for (const examplePath of examplePaths) {
const directory = path.dirname(examplePath);
- const packageNameMatch = directory.match(/packages\\([^\\]+)/);
+ const packageNameMatch = directory.match(/packages[\\\/]([^\\\/]+)/);
if (!(packageNameMatch && packageNameMatch.length > 1)) continue;
const packageName = packageNameMatch[1];
const exampleName = path.basename(directory);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels