记一次 vue + ts 开发踩坑
本次项目开发,使用了 vue-cli + ts + eslint + prettier + vs-code + vetur,
遇到的问题
配置相关
vscode eslint 不能在在*.vue或*.ts 中正常工作
需要为eslint.options.validateLanguage添加 vue 和ts 的支持
vscode prettier不能在*.vue或*.ts 中正常工作
需要修改prettier-eslint的源码
eslint 提示 import 的模块 unsused
手动安装eslint eslint-plugin-typescript 并设置unsed-var规则
vscode始终提示装饰器的警告无法找到
vue配合tsconfig时,需要将tsconfig所在的文件作为单独的workspace打开
在style less中使用alias路径
使用
~@/xxx/xxx
在vue中使用jsx
tsconfig.json:
jsx:preserve, jsxRefactor: h
Warning: 不应该让ts对jsx进行处理; 需要声明额外的d.ts,让ts知道jsx的类型
use .tsx
多个export * from './model' 提示undefined
每个export之间需要换行
开发相关
koa使用 axios 转发请求,并转发:
如果需要使用koa转发二进制资源,需要设置
responseType: 'arraybuffer'
如何构建 https 服务
准备一台服务器,准备一个域名
构建node server
证书
格式说明
获得自签名证书
获得正式证书(阿里云 赛门铁克)
node server use https server & certificates
http-server use certificates
mongodb 如何备份数据
atlas 云服务,实时备份,定时备份
cp
适合轻量数据
不会备份索引,需要restore之后重新构建
不会备份 local db
github + jenkins 持续构建
任务相关
不允许在jenkins的主进程中修改 working dir
只能在jenkins的容器里执行操作
指定 branch为空
或者指定 refspec
使用docker容器集成 server 服务
推荐的库类
项目中使用的库类
pinyin 中文拼音分词,获取拼音、多音字
dayjs 类moment api的时间库
node-cache node memory内存
consolidate 模版引擎渲染
nodejsonwebtoken 接口安全校验 example
Last updated
Was this helpful?