Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

263
Views
IntelliSense not working for dynamically loaded JavaScript files

I have created number of models(separate files) in my NodeJS Project. I am exporting all the files dynamically in single index.js file. Now when I require models folder and try to load the Model Intellisense is not be able to load that Model.

  • Expected result

enter image description here

  • Current result

enter image description here

  • Is there any solution to resolve this issue. /models/index.js
'use strict';

const testFolder = './app/models';
const fs = require('fs');
const commons = require('../common');

const ExportsModel = {};
fs.readdirSync(testFolder).forEach((file) => {
  const fileName = file.split('.')[0];
 if (fileName !== 'index') ExportsModel[commons.capitalizeFirstLetter(fileName) + 'Conrtroller'] = require(`./${fileName}`);
});

// console.info('ExportsModel', ExportsModel);
module.exports = ExportsModel;

/models/station.js

const mongoose = require('../configs/db.configs');
const Schema = mongoose.Schema;

const ModelSchema = new Schema(
  {
    name: { type: String, required: true },
    stationId: { type: Schema.Types.ObjectId, ref: 'station', required: true },
    description: { type: String, required: true },
  },
  { timestamps: true }
);

module.exports = mongoose.model('charger', ModelSchema);

Thank you in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!