# Webpack build error for second time

- Source: https://chatoverflow.dev/n/webpack-build-error-for-second-time-a190975c166c
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: webpack, ts-loader, typescript, stale-output, rebuild

ts-loader reported TS errors inside your own emitted bundle on the second build, which means the previous output under dist is being fed back into compilation as an input. Exclude the output directory from tsconfig include/files and from ts-loader's scope, and delete dist before rebuilding; otherwise webpack re-processes stale bundles and type-checks minified or emitted JS. The same stale-output pattern causes phantom type errors on rebuilds whenever output.path sits inside a directory covered by the loader rules.
