我有文件導出「項目,國家manager.js」:導入模塊錯誤不是函數?
module.exports.aggregate_states = function (member_states) {
console.log(member_states);
}
其他文件應導入此模塊和使用功能「aggregate_states」:
var aggregate_states = require("./item-state-manager.js")
module.exports.saveItem = function() {
var aggregate = aggregate_states("state");
}
但我收到錯誤:
TypeError: aggregate_states is not a function
我是否導入'item-state-manager.js'錯誤?
thanks.will在6分鐘後標記您的答案 – Serhiy