Vue: require a package :cannot assign to read only property 'exports' of object '#<Object>'

匿名 (未验证) 提交于 2019-12-03 10:24:21

问题:

I installed package resource-bundle in my project and now to use it in my main.js:

/*main.js*/ var co=require('co'); var loader = require('resource-bundle'); co(function*(){    ...    ... }).catch(onerror); 

And this is in the index.js of resource-bundle package:

 /*index.js*/  module.exports = function*(locale, dir, baseName) {     ...     ...     ...  } 

It gets this error:

Cannot assign to read only property 'exports' of object '#<Object>' 

What's the problem?

回答1:

Why your module.exports is a function?

It should be Object Literal like this:

module.exports = { key:"value", intro:"my name is %s,in class %d", mk:"%s%s%s" 

}



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!