我正在尝试为我的所有模型设置一个简单的索引文件。最终,我的目标是做这样的事情......
// models/A.model.js
...
const A = model(...);
const otherA = ...;
export { A, otherA };
// models/B.model.js
...
const B = model(...);
const otherB = ...
export { B, otherB };
// models/index.js
export * from './A.model.js';
export * from './B.model.js';
// server/index.js
import * as models from './models'
models.A
models.otherA
等
目前看起来好像models / index.js文件没有导出任何内容。我可能这样做完全错了。我使用的是Babel并使用this作为参考