简体   繁体   中英

Getting undefined on module exports

I'm getting a undefined when exporting a object with multiple functions as fields.

I'm exporting them as follows:

module.exports = {
  getArticleById: getArticleByIdFromModel
}

When I'm trying to importing

const { getArticleById } = require('../article/Article.selectors.js');
// or 
const selectors = require('../article/Article.selectors.js')

I'm getting both undefined, on getArticleById and selectors. Is my exporting syntax wrong? or something else? I'm using node 9.11.2

I was a cyclic dependency. I was importing A to B and B to A

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM