Skip to content

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

Description

@oleksandr-danylchenko

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().

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions