Skip to content

vite type check: generated moduleSuffixes override the project's chain #11480

Description

@aleclarson

Summary

The typescriptCheckPlugin added in #11450 generates a scratch tsconfig that sets compilerOptions.moduleSuffixes to a fixed ['.<platform>', '.native', ''] (from getModuleSuffixes() in helpers/typescript-check.js). This overrides the project's own moduleSuffixes chain instead of extending it, so files carrying custom suffix tiers — e.g. a shared-mobile .mobile tier that app code and third-party libraries use between the OS qualifier and the unsuffixed default — fail the build-time type check with TS2307 even though the same imports resolve in the app's own tsconfig and at bundle time via resolve.extensions.

Reproduction

// shared/use-thing.ts
import { thing } from './Thing'   // Thing.mobile.ts exists
// app tsconfig
{ "compilerOptions": { "moduleSuffixes": [".ios", ".android", ".mobile", ""] } }

ns build ios --env.typecheck reports Cannot find module './Thing'; tsc -p tsconfig.json is clean.

Suggested fix

Either:

  • merge the project's moduleSuffixes with the generated ones (project chain takes precedence, or append the generated entries), or
  • derive the generated chain from the project's moduleSuffixes directly — the scratch config already extends the project tsconfig, so simply dropping the override when the project declares moduleSuffixes would work.

Happy to send a PR if either direction sounds right.

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