使用命令行构建后怎么调用hot-update插件?

最近在接热更新,结果遇到个很坑的问题,准备自己写一个脚本来自动构建两次,现在遇到个问题,就是构建完成后没有调用插件hot-update,导致main.js前面那段设置搜索路径的代码没有插入进去,请问这块该怎么处理?
版本2.4.2

注入过程写到脚本里不行吗

就是这么想的。。。不会写,正在摸索,以前没写过js

const fs        = require("fs")
const path      = require("path")
let mainJsPath  = path.resolve(__dirname, 'build', 'jsb-binary', 'main.js');
let content     = fs.readFileSync(mainJsPath,"utf8")
content         = content.replace('window._CCSettings = undefined', '// window._CCSettings = undefined');
content         = content.replace('src/project.js', 'src/project-lobby.js');

var courseSearchPath      = String.raw`(function () {
    if (typeof String.raw == "undefined") {
        String.raw = function(str) {
            console.log("call string raw", str)
            return str
        }
    }
    if (typeof String.prototype.includes == "undefined") {
        String.prototype.includes = function(search, start) {
            if (typeof start !== 'number') {
                start = 0;
            }
            if (start + search.length > this.length) {
                return false;
            } else {
                return this.indexOf(search, start) !== -1;
            }
        };
    }
    var hotUpdateSearchPaths = cc.sys.localStorage.getItem('HotUpdateSearchPaths'); 
    if (hotUpdateSearchPaths) { 
        jsb.fileUtils.setSearchPaths(JSON.parse(hotUpdateSearchPaths)); 
    }`
content         = content.replace("(function () {", courseSearchPath);
fs.writeFileSync(mainJsPath,content,"utf8")

大佬6p!!!

这两句是你们自己定制的吧?能说下第一句为什么要注释掉么?

额,我们对资源路径重新解析处理,如果不注释会拿不到的

好的,感谢!
如果我这边没有额外处理的话其实是不需要这步的对吧?

还是直接写成脚本好,插件太依赖编辑器了,虽然构建一定是依赖编辑器

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。