0
如何我可以引用导出功能的Node.js的模块内,如:如何引用导出函数的Node.js模块的内部
'use strict';
const orm = require('orm');
module.exports = orm.createModel('Accounts');
const Project = require('./Project.js');
// this should be the result of orm.createModel('Accounts')
this.hasMany(Project, 'projects');
然而,我的棉短绒抱怨possible strict violation
。有没有办法做到这一点,而不需要定义一个变量?
前5行是'。/ Project.js'的内容吗?我不理解你的问题和你的文件结构。 – MinusFour
不,它是'./ Account.js'。基本上试着去做'const Account = orm.createModel('Accounts');'然后'module.exports = Account;'。 – Justin
那有什么问题? – MinusFour