aui / tmodjs

前端模板外置解决方案
666 stars 189 forks source link

tmod的getConfig方法在获取json的dependencies时的一个bug #97

Open hwoarangzk opened 9 years ago

hwoarangzk commented 9 years ago
if (!json) {

            json = {
                "name": 'template',
                "version": '1.0.0',
                "dependencies": {
                    "tmodjs": "1.0.0"
                },
                "tmodjs-config": {}
            };

        }

        var targetVersion = json.dependencies.tmodjs.replace(/^~/, '');    

这里如果项目本身只有devDependencies而没有dependencies时会出现tmodjs of undefined的错误。建议添加一下容错的逻辑:

if (!json.dependencies) {
    json.dependencies = json.devDependencies;
}
aui commented 9 years ago

能否把你的修改 Pull requests ?

hwoarangzk commented 9 years ago

@aui 好,稍后我来搞一下