creator发布web版本json配置文件丢失问题

项目中使用了json文件作为配置存储

 _loadJson(file, data) {
        let url = cc.url.raw("resources/cfg/" + file + ".json");
        cc.loader.load(url,
            function (curCount, totalCount, itemObj) {
            },
            function (err, results) {
                this._index++;
                if (err) {
                    console.log("解析配置文件" + file + "失败: " + JSON.stringify(err));
                } else {
                    if (results) {
                        // 在2.0中,返回的数据对象有变化
                        data['data'] = results.json || results;
                        console.log("---------------------------");
                        console.log(JSON.stringify(results.json));
                        console.log("---------------------------");
                        this._onProgress(file);
                        if (this._index >= this._totalIndex) {// 加载完成
                            this._onComplete();
                        }
                    } else {
                        this._onError(file);
                    }
                }
            }.bind(this));
    },

加载json使用了cc.loader.load接口,在开发预览过程中没有任何问题,当发布web版本后就出现上边的错误,根据错误提示,我发现发布的web-mobile本地竟然真的没有提示的文件,也就是说json好像真的没有参与构建,这。。。。。。bug
Cocos Creator v2.0.1
Cocos Creator v2.0.1-beta.2
都出现了该问题

最终在1.8.x版本中发现没有任何问题,现在可以确定的是,排除了代码的问题

@panda 上传了demo归档.zip (5.2 KB)


构建运行就会出错,读取不了json配置
Cocos Creator v2.0.1

这个问题是正常的,resources 下的资源,需要用 loadRes 加载才能转换为正确的路径。请用 cc.loader.loadRes(‘cfg’, function (…) { });