I'm starting to build a small app based on React, TypeScript and Webpack for building. I've followed this article: https://www.typescriptlang.org/docs/handbook/react-&-webpack.html
All the sources are stored at GitHub repo: https://github.com/aszmyd/webpack-react-typescript-bug
The issue:
When i start webpack dev server for local development it properly serves files under localhost:8080 and properly injects dynamic assets according to webpack configuration. But when i change something in source files, the rebuild gets fired and everything seems to be triggered properly but the dynamic assets are not injected into index.html. So after any change in source tsx files i get empty screen at localhost:8080 because the bundle.js file IS NOT INJECTED
So steps to reporoduce:
- Clone my test case repo: https://github.com/aszmyd/webpack-react-typescript-bug
- Install deps with
npm install - Run
npm start - Go to http://localhost:8080
- Change something in i.e.
src/components/Hello.tsx
The initial generated index.html looks as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
</head>
<body>
<div id="example"></div>
<script type="text/javascript" src="bundle.js"></script></body>
</html>
And after at least 1 webpack dev server watch tour and build:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
</head>
<body>
<div id="example"></div>
</body>
</html>