Skip to content

Build Error: Missing module 'node:path' & Deprecated #146

@auamod

Description

@auamod

Which project does this relate to?

Create Tanstack App

Describe the bug

Unable to build a fresh installation after running npx create-tsrouter-app@latest (npm run build).
Failing on vite.config.ts file.
npm run dev is runnng as intented.

Your Example Website or App

Steps to Reproduce the Bug or Issue

  1. run `npx create-tsrouter-app@latest'
  2. Selected options: File Router; Tailwind; Eslint.
  3. run npm run build.

Resulting Output:

> build
> vite build && tsc

vite v6.3.5 building for production...
Generated route tree in 91ms
✓ 130 modules transformed.
dist/index.html                   0.71 kB │ gzip:  0.39 kB
dist/assets/logo-CHtJT8UQ.svg     8.61 kB │ gzip:  3.65 kB
dist/assets/index-B4Er_6zW.css    4.96 kB │ gzip:  1.79 kB
dist/assets/index-8Dd7FAZT.js     0.83 kB │ gzip:  0.47 kB
dist/assets/index-Bq8pueRq.js   262.98 kB │ gzip: 83.68 kB
✓ built in 1.55s
vite.config.ts:6:25 - error TS2307: Cannot find module 'node:path' or its corresponding type declarations.

6 import { resolve } from 'node:path'
                          ~~~~~~~~~~~

vite.config.ts:15:3 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Object literal may only specify known properties, and 'test' does not exist in type 'UserConfigExport'.

15   test: {
     ~~~~

  node_modules/vite/dist/node/index.d.ts:3642:18
    3642 declare function defineConfig(config: UserConfigExport): UserConfigExport;
                          ~~~~~~~~~~~~
    The last overload is declared here.

vite.config.ts:21:20 - error TS2304: Cannot find name '__dirname'.

21       '@': resolve(__dirname, './src'),
                      ~~~~~~~~~


Found 3 errors in the same file, starting at: vite.config.ts:6

Expected behavior

Expected the build function to run on a fresh application.

Screenshots or Videos

No response

Platform

  • OS: WSL (Ubuntu) on Windows
  • Version NPM: 10.9.2
  • Version create-tsrouter-app: 0.16.5

Additional context

Errors coming solely from the vite.config.ts file.
Appears this config file has not been updated to reflect changes going on in other parts of the project (eg deprecated TanStackRouterVite).

Image

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