我試圖在我的nodeJS後端和Aurelia前端之間共享一些簡單的元數據類。我可以要求並使用從我的節點以下(V4.3)過程:如何編寫可以由NodeJS和Aurelia使用的ES6 class module
"use strict";
class PersonMetadata {
constructor() {
this.relation = ["Spouse/partner", "Child", "Parent", "Other"];
}
}
module.exports.PersonMetadata = PersonMetadata;
但它未能在瀏覽器中裝入由典型奧裏利亞前端處理後建立與:
Error: Cannot read property 'exports' of undefined
如何構建一個可以在節點& Aurelia之間共享的類的模塊?