Server unable to see files inside of imports folder on Heroku


I am building an app that works on localhost, but when deployed to a server (heroku) it crashes, stating Error: Cannot find module '../imports/api/pages.js'
The file exists and is found no problem when I run locally. I am thinking it has something to do with load order, but can’t for the life of me figure out why this file would not be available.

Here is my server/main.js file:

import { Meteor } from 'meteor/meteor';

import '../imports/api/pages.js';
import '../imports/api/content.js';

Meteor.startup(() => {
  // Do stuff...


Got exactly same issue. Did anybody solve that?


Did you try absolute imports?
import '/imports/..;


Fixed it.
Problem was in file names which were commited to git. Previously I changed file names in couple of files from lowercase to capital. Git doesnt track such changes automatically.
After pushing changes file names weren’t updated on both github and heroku remote repos.
Another pitfall is case sensitivity of filenames youre importing on Linux and Windows. As long as I’m developing on Windows I can import both ‘App.js’ and ‘app.js’. But if I push to heroku, I will get my app built on top of Linux, which won’t allow me to do such imports.

Solution: use ‘git mv file.js File.js’, if you want such renames to be tracked by git. Also don’t rely on case sensitivity of your system.