ytian-scabbard
ytian的本地服务和打包配置
安装
如果项目通过ytian
创建,则不需要单独安装。
yarn add ytian-scabbard -D
// or
npm install ytian-scabbard --save-dev
指令
serve
开启本地服务ytian-scabbard serve
参数 | 默认值 | 说明 | 示例 |
---|---|---|---|
--https | false | 使用https | ytian-scabbard serve --https |
--host | 本机ip | 修改host | ytian-scabbard serve --host 127.0.0.1 |
--port | 8088 | 修改端口 | ytian-scabbard serve --port 8888 |
--open | false | 自动打开浏览器 | ytian-scabbard serve --open |
打包编译 ytian-scabbard build
参数 | 默认值 | 说明 | 示例 |
---|---|---|---|
-R, --no-root | false | 是否设置publicPath | ytian-scabbard build -R |
-n, --project-name | ytian.config.js中的name | publicPath的值 | ytian-scabbard build -n my-app |
更多publicPath
相关内容可以看这里
配置文件
ytian-scabbard
的功能依赖于ytian.config.js
// ytian.config.js
module.exports = {
// 项目名称,执行 ytian-scabbard build -R 时的 publicPath 的默认值
name: 'my-app',
// 终端类型(pc|mobile)
target: 'pc',
// 项目类型(cc-center|spa|spa-pro)
type: 'cc-center',
// postcss-viewport的参数,只在target为mobile时生效,默认375
viewportWidth: 640,
// webpack-dev-server的proxy
// 详细配置可参考https://webpack.js.org/configuration/dev-server/#devserver-proxy
proxy: {
'/api': 'http://localhost:3000'
},
};