问题
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"
}
来源:https://stackoverflow.com/questions/48731457/vue-require-a-package-cannot-assign-to-read-only-property-exports-of-object