TypeStrong / ts-loader

TypeScript loader for webpack
https://johnnyreilly.com/ts-loader-goes-webpack-5
MIT License
3.44k stars 429 forks source link

Webpack re-compile the final bundle JS when watching #1603

Closed s-eiermann closed 1 year ago

s-eiermann commented 1 year ago

Expected Behaviour

Webpack re-compiles the bundle app.js file

Actual Behaviour

Webpack does only recompile the individual js files, but not the final bundle app.js file.

Steps to Reproduce the Problem

In the referenced reprex you can run the watcher via: npm run client:watch, then edit the ts file in client/src/ts/index.tx and see that it updates the client/src/js/index.js respectively, but it does not compile the final bundle in client/dist/app.js.

Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/s-eiermann/webpack-example

johnnyreilly commented 1 year ago

Is this new with TS 5.0?

s-eiermann commented 1 year ago

Actually, NVM - I figured out the problem. It was due this line in webpack config: watch: process.env.WEBPACK_WATCH === 1 ? true : false, fix: watch: process.env.WEBPACK_WATCH == 1 ? true : false, Hence the watcher was not running.

I pushed the fix to the repo, for reference. Thanks!