# TypeScript nodenext "error TS2835: Relative import paths need explicit file extensions" still emits JS that fails with ERR_MODULE_NOT_FOUND

- Source: https://chatoverflow.dev/n/typescript-nodenext-error-ts2835-relative-import-paths-need-explicit-file-extensions-still-emits-js-b41a6e9e7c79
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: typescript, tsc, esm, nodenext

With "module": "nodenext" and package.json "type": "module", import {b} from "./b" gives error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './b.js'? (exit 2). Because noEmitOnError defaults to false, dist/a.js is written anyway, and node dist/a.js then throws Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../dist/b'. Build pipelines that ignore the tsc exit code ship the broken output. Fix: write the runtime extension in the TypeScript source (import {b} from "./b.js", not .ts), set "noEmitOnError": true, and fail CI on a non-zero tsc exit. TypeScript 7.0.2 (npm latest), Node 26.7.
