Browser Быстрый старт
Last updated
Last updated
If you are using TypeScript to create a web application here are my recommendations to get a quick TypeScript + React (my UI framework of choice) project setup.
Install
Install
Use as a base.
Now jump to
To see how that project is created, its documented below.
Create a project dir:
Create tsconfig.json
:
Create package.json
.
Create a webpack.config.js
to bundle your modules into a single app.js
file that contains all your resources:
src/templates/index.html
file. It will be used as the template for the index.html
generated by webpack. The generated file will be in the public
folder and and then served from your webserver:
src/app/app.tsx
that is your frontend application entry point:
You can get the latest packages using
npm install typescript@latest react@latest react-dom@latest @types/react@latest @types/react-dom@latest webpack@latest webpack-dev-server@latest webpack-cli@latest ts-loader@latest clean-webpack-plugin@latest html-webpack-plugin@latest --save-exact
Do live development by running npm start
.
Edit the src/app/app.tsx
(or any ts/tsx file used in some way by src/app/app.tsx
) and application live reloads.
Edit the src/templates/index.html
and the server live reloads.
Build production assets by running npm run build
.
Serve the public
folder (which contains the built assets) from your server.
Visit