# 安装依赖
$ npm install
# 开发时构建
$ npm run dev
# 启动图片服务,请先将 http-server 安装到全局
$ cd cdn && http-server -p 88
# 打包构建
$ npm run build
# 指定平台的开发时构建(微信、百度、头条、支付宝)
$ npm dev:wx
$ npm dev:swan
$ npm dev:tt
$ npm dev:my
# 指定平台的打包构建
$ npm build:wx
$ npm build:swan
$ npm build:tt
$ npm build:my
# 安装
$ npm install --save-dev mpvue-entry@next
// webpack.base.conf.js
const MpvueEntry = require('mpvue-entry')
module.exports = {
entry: MpvueEntry.getEntry('src/app.json'),
...
plugins: [
new MpvueEntry(),
...
]
}
// app.json - 支持 js 格式,兼容微信小程序官方配置规范
{
"pages": [
{
"path": "pages/news/list",
"config": {
"navigationBarTitleText": "文章列表",
"enablePullDownRefresh": true
}
}
],
"window": {}
}
# 安装
$ npm install --save node-sass sass-loader