In Typescript, what's the best way to load a config across multiple modules? Should you do this in every module that needs the config:

`import config from ''./config.js"`

OR should you import the config once and pass the config as a variable to any functions that need it? e.g.

```
import config from ''./config.js"
startServiceA(config);
startServiceB(config);
...
```

4
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
Replies