42 lines
1.0 KiB
Markdown
42 lines
1.0 KiB
Markdown
|
## 开发
|
||
|
|
||
|
```bash
|
||
|
# 安装依赖
|
||
|
npm install
|
||
|
|
||
|
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
|
||
|
npm install --registry=https://registry.npmmirror.com
|
||
|
|
||
|
# 启动服务
|
||
|
npm run dev
|
||
|
```
|
||
|
|
||
|
浏览器访问 http://localhost:80
|
||
|
|
||
|
## 发布
|
||
|
|
||
|
```bash
|
||
|
# 构建测试环境
|
||
|
npm run build:stage
|
||
|
|
||
|
# 构建生产环境
|
||
|
npm run build:prod
|
||
|
```
|
||
|
|
||
|
## 报错
|
||
|
|
||
|
- Error: error:0308010C:digital envelope routines::unsupported
|
||
|
|
||
|
```bash
|
||
|
# package.json 中scripts 添加 SET NODE_OPTIONS=--openssl-legacy-provider window环境
|
||
|
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||
|
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
||
|
"build:stage": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode staging",
|
||
|
```
|
||
|
|
||
|
## 工具
|
||
|
|
||
|
- 若使用 vscode 开发代码,则可以安装一下插件辅助开发
|
||
|
- Prettier 统一代码格式,避免冲突
|
||
|
- i18n Ally 提高开发者翻译多语言的效率、简单出错率
|