Error: ParseError: Unterminated regular expression.
Which project does this relate to?
Start
Describe the bug
I setup a project from scratch, added shadcn package, added few components, then suddenly start getting error. here is the link of my code: https://github.com/thakuad/parsed-error-tan-stack/tree/main
➜ parsed-error-tan-stack git:(main) bun dev $ vite dev error when starting dev server: Error: ParseError: Unterminated regular expression. /Projects/parsed-error-tan-stack/modules/public/ui/components/nav-main.tsx:37:35 error: script "dev" exited with code 1
Your Example Website or App
https://github.com/thakuad/parsed-error-tan-stack/tree/main
Steps to Reproduce the Bug or Issue
- clone the git repo -https://github.com/thakuad/parsed-error-tan-stack/tree/main
- bun I
- bun dev
Expected behavior
As user I expected to run this project smoothly but got an error in terminal.
Screenshots or Videos
➜ parsed-error-tan-stack git:(main) bun dev $ vite dev error when starting dev server: Error: ParseError: Unterminated regular expression. /Projects/parsed-error-tan-stack/modules/public/ui/components/nav-main.tsx:37:35 error: script "dev" exited with code 1
Platform
- Router / Start Version: latest
- OS: macOS
- Browser: Safari
- Bundler: vite
- Bundler Version: latest
Additional context
No response
I'm not sure what the cause is, but it seems that there is a problem when importing files from a folder named “modules”. Changing the folder name or moving the modules folder into the src folder seems to solve the problem.
went down this rabbit hole a bit.
seems the modules folder is used by nitro. when the nitro server is created this folder is scanned for nitro modules and this brings forth the error. Documentation for this seems to be still pending: Nitro - docs: write the module guide.
It would seem the only viable option in this case is either rename or move as @w00khyung mentioned.
I'm not sure what the cause is, but it seems that there is a problem when importing files from a folder named “modules”. Changing the folder name or moving the modules folder into the src folder seems to solve the problem.
Thank you, i will rename or move folder into src folder.
went down this rabbit hole a bit.
seems the modules folder is used by nitro. when the nitro server is created this folder is scanned for nitro modules and this brings forth the error. Documentation for this seems to be still pending: Nitro - docs: write the module guide.
It would seem the only viable option in this case is either rename or move as @w00khyung mentioned.
It would be nice to have in Tanstack start documents, stating reserve folder or file name. Sure i will try to rename or move into src folder.
we are in the process of conceptually separating start and nitro as nitro is becoming a vite plugin on its own. this particular feature (scanning the "modules" folder) will most likely be disabled in that nitro vite plugin.
Thanks for raising this. This is definitely a good issue for anyone running into the same problem.
Nitro v3 vite plugin will disable scanning directories like modules/ 👍🏼