3.8.4
先看看案例:
案例1
目录:
build
|- wechatgame
|- wechatgame-SDK
build-templates
|- wechatgame
|- test.js
|- wechatgame-SDK
|- test2.js
打包出来:
build
|- wechatgame
|- test.js
|- test2.js
|- wechatgame-SDK
|- test.js
|- test2.js
build-templates
|- wechatgame
|- test.js
|- wechatgame-SDK
|- test2.js
案例2
目录:
build
|- wechatgame
|- wechatgame-SDK
build-templates
|- wechatgame
|- game.json
其中game.json
长这样
{
"plugins": {
"MiniGameCommon": {
"version": "latest",
"provider": "wxaed5ace05d92b218",
"contexts": [
{
"type": "isolatedContext"
}
]
}
},
"resizable": true
}
打包出来:
build/wechatgame-SDK/game.json
- 带有完整的内容
- 带有子包的内容
- 也带有
build-templates
里面的plugins
和resizable
{
"deviceOrientation": "portrait",
"openDataContext": "openDataContext",
"networkTimeout": {
"request": 5000,
"connectSocket": 5000,
"uploadFile": 5000,
"downloadFile": 500000
},
"plugins": {
"MiniGameCommon": {
"version": "latest",
"provider": "wxaed5ace05d92b218",
"contexts": [
{
"type": "isolatedContext"
}
]
}
},
"resizable": true,
"subpackages": [
{
"name": "xxx",
"root": "subpackages/xxx/"
}
// ...
]
}
build/wechatgame/game.json
- 所有的信息都没了
- 完完全全就是把原来的
game.json
删了, 然后把build-templates/game.json
复制过来
{
"plugins": {
"MiniGameCommon": {
"version": "latest",
"provider": "wxaed5ace05d92b218",
"contexts": [
{
"type": "isolatedContext"
}
]
}
},
"resizable": true
}
疑问
-
build-templates
里面的目录叫wechatgame
, 为什么我打包wechatgame-SDK
也会生效呢? - 这个目录名, 它是怎么匹配的?
wechatgame
是指wechatgame平台
呢? 还是指build/wechatgame
这个输出目录呢? - 为什么匹配
wechatgame-SDK
的时候,game.json
是融合json的内容, 但是匹配wechatgame
的时候, 确是整个文件删除替换呢?