Browser Быстрый старт
TypeScript в браузере
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.
General Machine Setup
Project Setup Quick
Use https://github.com/basarat/react-typescript as a base.
git clone https://github.com/basarat/react-typescript.git
cd react-typescript
npm installNow jump to develop your amazing application
Project Setup Detailed
To see how that project is created, its documented below.
Create a project dir:
mkdir your-project
cd your-projectCreate
tsconfig.json:
Create
package.json.
Create a
webpack.config.jsto bundle your modules into a singleapp.jsfile that contains all your resources:
src/templates/index.htmlfile. It will be used as the template for theindex.htmlgenerated by webpack. The generated file will be in thepublicfolder and and then served from your webserver:
src/app/app.tsxthat is your frontend application entry point:
Develop your amazing application
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.Visit http://localhost:8080
Edit the
src/app/app.tsx(or any ts/tsx file used in some way bysrc/app/app.tsx) and application live reloads.Edit the
src/templates/index.htmland the server live reloads.
Build production assets by running
npm run build.Serve the
publicfolder (which contains the built assets) from your server.
Last updated