当前位置:网站首页>Build typescript project process locally
Build typescript project process locally
2022-07-21 22:15:00 【Front end white L】
1. initialization
cnpm init —yes
2. Global installation typescript
cnpm install typesrcipt -g
3. Generate tsconfig file
tsc —int
4. modify tsconfig.json Configuration in
"outDir": "./dist" outDir yes ts Automatically generated after compilation js File storage directory
"rootDir": "./src" rootDir I wrote it myself ts The directory where the source file is located
5. compile src In the catalog ts file
tsc
6. Global installation ts-node
cnpm install ts-node -g
7. install nodemon Tools ( Automatically detect code updates and restart projects )
cnpm install -g nodemon
8. stay package.json Configure automatic detection in , Automatically restart the application
"scripts": {
"dev": "nodemon --watch src/ -e ts --exec ts-node ./src/app.ts"
}
nodemon --watch src/ Indicates that the detection directory is package.json At the same directory src
-e ts Express nodemon The command is ready to listen to ts Postfix file
--exec ts-node .lsrc/projectJapp.ts Indicates that src Any changes in the directory must be re executed app.ts file
9.parcel Automatic packaging supports browser operation ts file
- install parcel Packaging tools :cnpm install parcel-bundler --save-dev
- Create a new index.html, To introduce index.ts
- stay package.json Middle feeding npm Add a startup entry , Support startup parcel tool kit
"scripts": {
"start": "parcel ./index.html"
},
- start-up parcel tool kit
npm start
After startup, as shown in the figure :
边栏推荐
- 科学证据:吃nmn对胆囊炎有作用吗,nmn临床效果如何
- 使用tornado实现本地聊天室
- Cortex-a53 developed from bare metal_ Development Notes (64 bit)
- 【半导体先进工艺制程技术系列】SOI技术(下)
- 通用流程编排引擎介绍
- About the understanding of automated testing: purpose and essence! (must see for beginners)
- Addition, subtraction, multiplication and division of numbers of string type
- Label Embedding Online Hashing for Cross-Modal Retrieval
- Write a program that completely intercepts user operations
- UI自动化测试之ddt实战
猜你喜欢
随机推荐
vscode小设置
参与开源社区还有证书拿?
Imitate memz to make a special effect program
[ALM] Introduction to the demand management solution of polaron ALM
从T型人才理解ALM Polarion
G, it's the new year, and suddenly the leader assigned a new task
Share | ISO 26262 + FMEA concepts + polarization template
超级详细-NMOS、PMOS的工作原理及相关内容整理(下)
Cortex-a53 developed from bare metal_ Development Notes (64 bit)
Raspberry pie 4B sound sensor do module
【ALM】POLARION ALM之需求管理解决方案介绍
如何写好技术安全需求TSR?
How to realize the association between interfaces in JMeter?
【半导体先进工艺制程技术系列】SOI技术(上)
DDT practice of UI automated testing
Some superficial research and development stages involve software summarization
检测设备开发的作用及应用的行业有哪些?
Sonova sonova reduced the time of compliance documents by 80% using polarion
建立数据驱动,关键字驱动和混合Selenium框架这些你了解吗
STM32系列TIMER互补输出详解