无法从 users.js 文件导入 Users 数组
尝试使用 import 语句以及 with
进行导入const Users = require('users')' // this is the code i have been using to import the file
两个文件,index.js 和 users.js 都在同一目录中
如果您不使用模块,则必须将导出类型更改为
module.exports= {Users}
或 export.Users = Users
。
将
index.js
文件中的用户导入为
const { Users } = require("./users.js");
检查 CodeSandbox 以解决您的问题此处。