TypeStrong / TypeStrong/ts-loader

ts-loader doesn't work when ts-config noEmit is set to true

Open
#1,602 25 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.5k
Forks
439
Avg merge
17h 17m
Merged PRs (30d)
2

Description

TypeScript: v5.0.2
Webpack: v5.76.3

Expected Behaviour

When bundling a ESM module with noEmit, Webpack is able to generate a bundle using ts-loader

Actual Behaviour
Module build failed (from ./node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for C:\Users\ms\Projects\ts-loader\index.ts.
    at makeSourceMapAndFinish (C:\Users\ms\Projects\ts-loader\node_modules\ts-loader\dist\index.js:52:18)
    at successLoader (C:\Users\ms\Projects\ts-loader\node_modules\ts-loader\dist\index.js:39:5)
    at Object.loader (C:\Users\ms\Projects\ts-loader\node_modules\ts-loader\dist\index.js:22:5)
Steps to Reproduce the Problem
  1. Clone the demo repository
  2. npm-install
  3. npm-run-build it
Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/minecrawler/ts-loader

Further info

connected to #161

Contributor guide

Open the contributing guide

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

Start with the linked minimal repository: install its dependencies and run the build using TypeScript 5.0.2 and webpack 5.76.3. Trace the failure through ts-loader/dist/index.js at makeSourceMapAndFinish and successLoader, using the index.ts entry point; done means the ESM bundle builds successfully when noEmit is true without the emitted-no-output error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.