netlify / netlify/framework-adapters

`@netlify/vite-plugin` fails to load under `TypeScript 7` via `ts-api-utils` `TypeFlags` access

Open
#65 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1
Forks
3
Avg merge
1d 7h
Merged PRs (30d)
9

Description

Summary

@netlify/vite-plugin@3.0.1 installs successfully in a Vite 8 project, but vite build fails while loading vite.config.mts when the project uses typescript@7.0.2.

The failure appears to come from the plugin's dependency path through @netlify/dev/@netlify/zip-it-and-ship-it into precinct -> detective-typescript -> @typescript-eslint/typescript-estree -> ts-api-utils. That tooling currently expects the older TypeScript CommonJS API shape.

Environment
node: 24.19.0
npm: 12.0.2
vite: 8.2.0
typescript: 7.0.2
@netlify/vite-plugin: 3.0.1

@netlify/vite-plugin@3.0.1 declares support for Vite 8 and Node >=22.12.0, so the direct package constraints are satisfied.

Minimal config shape
import netlify from "@netlify/vite-plugin";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [netlify()],
});
Actual behavior

tsc -b passes, but vite build fails before the app build starts:

failed to load config from /path/to/vite.config.mts
error during build:
TypeError: Cannot read properties of undefined (reading 'Intrinsic')
    at Object.<anonymous> (/path/to/node_modules/ts-api-utils/lib/index.cjs:787:57)
    at Module._compile (node:internal/modules/cjs/loader:1872:14)
    at Object..js (node:internal/modules/cjs/loader:2003:10)
    at Module.load (node:internal/modules/cjs/loader:1594:32)
    at Module._load (node:internal/modules/cjs/loader:1396:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.require (node:internal/modules/cjs/loader:1617:12)
    at require (node:internal/modules/helpers:153:16)
    at Object.<anonymous> (/path/to/node_modules/precinct/node_modules/@typescript-eslint/typescript-estree/dist/convert-comments.js:37:30)
Dependency path
@netlify/vite-plugin@3.0.1
└─ @netlify/dev@5.0.5
   └─ @netlify/functions-dev@2.0.5
      └─ @netlify/zip-it-and-ship-it@15.5.0
         └─ precinct@12.3.2
            └─ detective-typescript@14.1.2
               └─ @typescript-eslint/typescript-estree@8.69.0
                  └─ ts-api-utils@2.5.0

@typescript-eslint/typescript-estree@8.69.0 has a TypeScript peer range of >=4.8.4 <6.1.0. With typescript@7.0.2, require("typescript") only exposes:

[ 'version', 'versionMajorMinor' ]

So this line in ts-api-utils crashes because TypeFlags is undefined:

ts.TypeFlags.Intrinsic
Expected behavior

One of these would work:

  1. @netlify/vite-plugin does not load the TypeScript-analysis dependency path during ordinary Vite config loading/builds unless needed.
  2. The dependency chain is updated to TypeScript 7-compatible tooling.
  3. The package documents that TypeScript 7 projects are not currently supported, despite the Vite/Node peer constraints being satisfied.

Reproduction

https://github.com/oleksandr-danylchenko/testing-router-with-netlify-plugin

Notes

This is distinct from installation. The package installs cleanly. The runtime failure happens when Vite loads the config containing netlify().

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the linked testing-router-with-netlify-plugin project and the versions listed above, then inspect the dependency path through precinct, detective-typescript, @typescript-eslint/typescript-estree, and ts-api-utils. Start with ts-api-utils/lib/index.cjs and the convert-comments.js stack location, and determine whether the dependency path can avoid loading or must be updated for TypeScript 7. Done means vite build loads the config successfully, or the supported TypeScript range is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript, vite
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.