0👍
Actually, in your config you have two exports, so for correctly accessing it you should name the exported objects:
module.exports.config = {
port: process.env.PORT || 8081,
db: {
database: process.env.DB_NAME || 'vue',
user: process.env.DB_USER || 'vue',
password: process.env.DB_PASS || 'vue',
options: {
dialect: process.env.DIALECT || 'sqlite',
host: process.env.HOST || 'localhost',
storage: 'vue.sqlite.sql'
}
}
}
module.exports.otherConfigs = {
// other configs ..
}
Then in model’s index.js you import the configs like that:
const { config, otherConfigs } = require('../config/config')
Source:stackexchange.com