TypeScript in the browser
cd your-project
{
"name": "react-typescript",
"version": "0.0.0",
"license": "MIT",
"type": "git",
"url": "https://github.com/basarat/typescript-react.git"
},
"scripts": {
"build": "webpack ./webpack.config.js -p",
},
"dependencies": {
"@types/react": "16.0.40",
"@types/react-dom": "16.0.4",
"react": "16.2.0",
"react-dom": "16.2.0",
"ts-loader": "4.0.1",
"typescript": "2.7.2",
"webpack": "4.1.1",
"webpack-dev-server": "3.1.1"
}
}
- Create a to bundle your modules into a single
app.js
file that contains all your resources:
public/index.html
file that will be served from your webserver:
<html>
<body>
<div id="root"></div>
<script src="./build/app.js"></script>
</body>
</html>
src/app/app.tsx
that is your frontend application entry point:
Develop your amazing application
- Do live development by running
npm start
.