上一篇有學到使用 module.exports 繪出想要的模組資料,
1 | var data = { |
直接使用 exports 匯出資料
1 | exports.data = { |
透過 app.js 印出資料
1 | node app.js |
exports 與 module.exports 無法共用
如題,不建議同時在檔案中使用 exports 跟 module.exports,因為 module.exports 的內容會把前面 exports 的內容覆蓋掉,
上一篇有學到使用 module.exports 繪出想要的模組資料,
1 | var data = { |
1 | exports.data = { |
透過 app.js 印出資料
1 | node app.js |
如題,不建議同時在檔案中使用 exports 跟 module.exports,因為 module.exports 的內容會把前面 exports 的內容覆蓋掉,