I have this code at the bottom of a file called ‘/imports/api/db-connectors.js’:
const Instant_messages = db.models.instant_messages;
const a = 100; //<== breakpoint here shows an object with fields, etc., stored in Instant_messages
export {Instant_messages };
Then at the top of another file, I have this import statement:
import {Instant_messages } from ‘/imports/api/db-connectors’;
import { Kind } from ‘graphql/language’;
const b = 100; <==breakpoint here shows no such local var as Instant_messages
…there is no local variable named Instant_messages available to reference.
Does it work if you use relative paths`? And can any auto-completion in your IDE help you verify that the paths and export/import variable names are correct?
Great. That trick has also helped me quite often.
Let’s say the file you import into is placed in the /imports folder - then the relative path in the import statement would be be ./api/do-connectors
When you start the path with a / it will be from the root of your project.
If you open the whole folder that contain your project it should work. For instance, when I press control (windows) or command (mac) and hover the path in the import statements I’m able to use them as links.