Case Sensitivity and Builds

Summary

When writing code, be careful to use the exact file name when importing, or in any code that uses file paths. Some operating systems are not case sensitive — but if your code runs on a system that is, the code will fail.

Explanation

When pushing to Pro, a common build error relates to importing files, or other file paths.

Recall that every git push results in an automatic build. If your build fails and you see npm run build failed error, look higher in the build log and you may see an error like this:

In this example, note that the transpiler is complaining that the file models/Pass.ts could not be found. The file is actually named models/pass.ts, with a lower-case p. Therefore, the import should read import ../../models/pass. Some operating systems won't complain that the file name doesn't exactly match. But most UNIX-based systems will complain.

It turns out that both Windows and the Mac OS are not case sensitive. (For Mac OS that's particularly unintuitive, since that OS is based on UNIX. But by default, Mac OS does ignore case.) UNIX is case sensitive, and the Ionic Pro servers are typically housed on Linux servers. That means case mis-matches will result in a build error in Pro.

In summary, you should be careful to use the actual file names in import statements, or in any code that uses file paths.