I've been grappling with the nuances between import
and require
when it comes to using classes/modules from other files. The confusion arises when I try to use require('./config.json')
and it works, but
import config from './config.json'
does not.
Could it be that import only accepts classes/modules and cannot work with JSON?
Furthermore, my understanding is that import functions during compile time while require operates at runtime. All of this has left me feeling quite perplexed.