我在我的项目中安装了包resource-bundle,现在在main.js中使用它:
/*main.js*/
var co=require('co');
var loader = require('resource-bundle');
co(function*(){
...
...
}).catch(onerror);
这是在资源包软件包的index.js中:
/*index.js*/
module.exports = function*(locale, dir, baseName) {
...
...
...
}
收到此错误:
Cannot assign to read only property 'exports' of object '#<Object>'
有什么问题?
答案 0 :(得分:-1)
为什么你的module.exports是一个函数?
它应该是Object Literal,如下所示:
module.exports = {
key:"value",
intro:"my name is %s,in class %d",
mk:"%s%s%s"
}