我正在尝试将一个对象导入猫鼬模式,但出现“意外标识符”错误。我是否犯语法错误,我不确定如何导出。

我的导出对象


const electronic = {
    title: { type: String },
    description: { type: String },
    price: { type: String },
    location: { type: String },
    image: { type: Array },
    phone: {
        type: String
    },
    email: {
        type: String
    },
    author: {
        type: String,
        ref: 'User'
    }
}

export default electronic


我在哪里导入对象

const mongoose = require('mongoose');
import electronic from '../master_objects/electronics'

const electronics = new mongoose.Schema(
    electronic, {
    timestamps: true
});

module.exports = mongoose.model('vancouver_electronic', electronics);

最佳答案

而不是对export default electronicmodule.exports=electronic
有关更多信息,Getting Unexpected Token Export

07-24 17:17