修复热更新插件在2.3.4版之后出现的问题

在路劲
C:\Users\Administrator.CocosCreator\packages\hot-update-tool

替换文件
main.zip (993 字节)

已经测试过了,热更新插件主要的问题还是代码老了
经过很多次测试查资料
我发现官方https://github.com/cocos-creator/tutorial-hot-update这个里面的代码时可用的


// 在 main.js 的开头添加如下代码
(function () {
if (typeof window.jsb === ‘object’) {
var hotUpdateSearchPaths = localStorage.getItem(‘HotUpdateSearchPaths’);
if (hotUpdateSearchPaths) {
var paths = JSON.parse(hotUpdateSearchPaths);
jsb.fileUtils.setSearchPaths(paths);

        var fileList = [];
        var storagePath = paths[0] || '';
        var tempPath = storagePath + '_temp/';
        var baseOffset = tempPath.length;

        if (jsb.fileUtils.isDirectoryExist(tempPath) && !jsb.fileUtils.isFileExist(tempPath + 'project.manifest.temp')) {
            jsb.fileUtils.listFilesRecursively(tempPath, fileList);
            fileList.forEach(srcPath => {
                var relativePath = srcPath.substr(baseOffset);
                var dstPath = storagePath + relativePath;

                if (srcPath[srcPath.length] == '/') {
                    cc.fileUtils.createDirectory(dstPath)
                }
                else {
                    if (cc.fileUtils.isFileExist(dstPath)) {
                        cc.fileUtils.removeFile(dstPath)
                    }
                    cc.fileUtils.renameFile(srcPath, dstPath);
                }
            })
            cc.fileUtils.removeDirectory(tempPath);
        }
    }
}

})();


最后我手动修改了插件的main.js文件 然后热更新插件变得好用多了

2赞

回头修复下

知道你去雅集的工作安排了,你就是负责插件的。。。

原始的那个确实有问题 第二次打开APP就变成老资源了

我这边下载的热更新插件还报错了。。。TypeError: Cannot read property ‘staticFileDir’ of undefined
creator版本2.4.1,修复好的话,把你二维码也发出来

1赞

如果不用热更新插件,直接用官方的热更新方案手动接入可以吗?

我没更新2.4版,没用到2.4版,等我用到了我会改一般发出来的。。。

你认错人了

1.0.0插件已经更新,重点适配2.4版本,新增本地测试功能

各个链接看看呗