router icon indicating copy to clipboard operation
router copied to clipboard

Error: ParseError: Unterminated regular expression.

Open thakuad opened this issue 1 year ago • 7 comments

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

  1. clone the git repo -https://github.com/thakuad/parsed-error-tan-stack/tree/main
  2. bun I
  3. 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

thakuad avatar Jul 17 '25 11:07 thakuad

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.

hyungwookchoi avatar Jul 17 '25 13:07 hyungwookchoi

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.

nlynzaad avatar Jul 17 '25 16:07 nlynzaad

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.

thakuad avatar Jul 17 '25 19:07 thakuad

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.

thakuad avatar Jul 17 '25 19:07 thakuad

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.

schiller-manuel avatar Jul 17 '25 20:07 schiller-manuel

Thanks for raising this. This is definitely a good issue for anyone running into the same problem.

nlynzaad avatar Jul 17 '25 20:07 nlynzaad

Nitro v3 vite plugin will disable scanning directories like modules/ 👍🏼

pi0 avatar Jul 17 '25 20:07 pi0