What is the operating logic of build-templates?

3.8.4

Let’s look at the case first:

Case 1

Table of contents:

build
 |- wechatgame
 |- wechatgame-SDK
build-templates
 |- wechatgame
    |- test.js
 |- wechatgame-SDK
    |- test2.js

Package out:

build
 |- wechatgame
    |- test.js
    |- test2.js
 |- wechatgame-SDK
    |- test.js
    |- test2.js
build-templates
 |- wechatgame
    |- test.js
 |- wechatgame-SDK
    |- test2.js

Case 2

Table of contents:

build
 |- wechatgame
 |- wechatgame-SDK
build-templates
 |- wechatgame
    |- game.json

game.json The length of it is like this

{
    "plugins": {
        "MiniGameCommon": {
            "version": "latest",
            "provider": "wxaed5ace05d92b218",
            "contexts": [
                {
                    "type": "isolatedContext"
                }
            ]
        }
    },
    "resizable": true
}

Package out:

build/wechatgame-SDK/game.json

  • With complete content
  • Content with subpackages
  • Also with build-templates the inside plugins andresizable
{
    "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

  • All the information is gone
  • It is to delete the original one game.json and then build-templates/game.json copy it.
{
    "plugins": {
        "MiniGameCommon": {
            "version": "latest",
            "provider": "wxaed5ace05d92b218",
            "contexts": [
                {
                    "type": "isolatedContext"
                }
            ]
        }
    },
    "resizable": true
}

doubt

  • build-templates The directory inside is called , why does it work when wechatgame I package it ?wechatgame-SDK
  • How does this directory name match? wechatgame Does it refer to wechatgame平台 ? Or build/wechatgame does it refer to the output directory?
  • Why is it that wechatgame-SDK when matching , game.json the json content is merged, but wechatgame when matching , the entire file is deleted and replaced?
1 Like

document.documentElement.clientWidth
document.documentElement.clientHeight
Get the size of the browser content area
Then calculate the size of the div proportionally
Then modify the div/canvas size

iOS does not support OGG audio playback