Skip to content

Building from TS/vite app causes an error #41

Closed

Description

@cfjedimaster

I scaffolded an app using the Vite/TS default and when I build, I get:

raymondcamden@Juniper-Montage-4 myapp2 % tinyjs build
==> bundling backend (esbuild)
==> frontend build: npm run build

> [email protected] build
> tsc && vite build --base=./

error TS2688: Cannot find type definition file for 'vite/client'.
  The file is in the program because:
    Entry point of type library 'vite/client' specified in compilerOptions
  tsconfig.json:6:15 - File is entry point of type library specified here.
    6     "types": ["vite/client"],
                    ~~~~~~~~~~~~~

As far as I know, I didn't change anything after scaffolding.

Activity

  1. tarwin commented on Oct 5, 2026

    @tarwin
    Owner

    Thanks for the report @cfjedimaster. I can reproduce it: this happens when the scaffolded project's packages aren't installed yet. tinyjs new --template … prints npm install as the next step, but nothing enforced it. Without node_modules, npm run build runs tsc && vite build, picks up a globally installed tsc, and that can't find vite/client's types, which gives exactly this error.

    Workaround now: run npm install in the project, then tinyjs build (or tinyjs dev).

    Fix (next release): tinyjs build and tinyjs dev check for installed packages before running the project's own build or dev command, and stop with "no node_modules for this project … run npm install first" instead of the tool's error. A node_modules in a parent folder (workspaces) and Yarn PnP both count. The same branch also documents the folder settings: "backend" picks the backend entry, and "frontend": { "dir": … } picks the plain page folder (default src/frontend).

  2. added 2 commits that reference this issue on Oct 5, 2026
  3. tarwin commented on Oct 5, 2026

    @tarwin
    Owner

    Fixed in v0.49.0: tinyjs build and tinyjs dev now stop with "run npm install first" when a bundler project has no node_modules. The folder settings ("backend", "frontend": { "dir" }) are documented too. Thanks again @cfjedimaster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions