Skip to content

Got an error when renaming or creating a new route file when using with rsbuild #4437

Closed
@YiCChi

Description

@YiCChi

Which project does this relate to?

Router

Describe the bug

After bump @tanstack/router-plugin's version from 1.120.15 to 1.121.16, I got the following error when renaming or creating a new route file

node:path:1223
    validateString(path, 'path');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at normalize (node:path:1223:5)
    at FSWatcher.generate (file://~/dev/repos/web-yoyaku/node_modules/.pnpm/@tanstack+router-plugin@1.121.16_@rsbuild+core@1.3.22_@tanstack+react-router@1.121.16_r_a9dc86ae54cfb4975fe9cf4330098133/node_modules/@tanstack/router-plugin/dist/esm/core/router-generator-plugin.js:26:24)
    at FSWatcher.emit (node:events:518:28)
    at FSWatcher.emitWithAll (~/dev/repos/web-yoyaku/node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js:540:8)
    at FSWatcher._emit (~/dev/repos/web-yoyaku/node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js:632:8)
    at FsEventsHandler.handleEvent (~/dev/repos/web-yoyaku/node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js:291:14)
    at FsEventsHandler.addOrChange (~/dev/repos/web-yoyaku/node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js:241:8)
    at FsEventsHandler.checkExists (~/dev/repos/web-yoyaku/node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js:249:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}

then I downgrade to 1.120.15 but got the following error

TypeError: (0 , _routerGenerator.generator) is not a function
    at generate (~/dev/repos/rsdoctor_tanstack-router/node_modules/.pnpm/@tanstack+router-plugin@1.120.15_@rsbuild+core@1.3.22_@tanstack+react-router@1.120.15_r_5ce8836f706f4dad1b1a24f7fd14355f/node_modules/@tanstack/router-plugin/dist/esm/core/router-generator-plugin.js:22:44)
    at run (~/dev/repos/rsdoctor_tanstack-router/node_modules/.pnpm/@tanstack+router-plugin@1.120.15_@rsbuild+core@1.3.22_@tanstack+react-router@1.120.15_r_5ce8836f706f4dad1b1a24f7fd14355f/node_modules/@tanstack/router-plugin/dist/esm/core/router-generator-plugin.js:46:13)
    at ~/dev/repos/rsdoctor_tanstack-router/node_modules/.pnpm/@tanstack+router-plugin@1.120.15_@rsbuild+core@1.3.22_@tanstack+react-router@1.120.15_r_5ce8836f706f4dad1b1a24f7fd14355f/node_modules/@tanstack/router-plugin/dist/esm/core/router-generator-plugin.js:78:15

It seems that @tanstack/router-generator is still 1.121.16 because of ^ here. After pin @tanstack/router-generator to 1.120.15, everything works well.

Your Example Website or App

https://github.com/YiCChi/rsdoctor_tanstack-router

Steps to Reproduce the Bug or Issue

  1. run pnpm dev to start dev server
  2. create a new route file or rename a existing route file
  3. everything works well
  4. pnpm update --latest to bump tanstack router to the latest
  5. run pnpm dev to start dev server
  6. create a new route file or rename a existing route file
  7. got the first error
  8. downgrade tanstack router releated deps to 1.120.15 and run pnpm i
  9. run pnpm dev to start dev server
  10. got the second error

Expected behavior

When creating a new route file, it will be fulfilled with template code.

Screenshots or Videos

No response

Platform

System:
OS: macOS 15.5
CPU: (10) arm64 Apple M2 Pro
Memory: 74.91 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Browsers:
Chrome: 137.0.7151.104
Safari: 18.5

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions