How to make the shared addon state same in both app and the engine?

I have a file in shared addon which stores an object with zero data in the beginning. When my app boots up the initializer add some data into this object. There is an engine that is expecting to have these data to be present.

According to my current setup, the engine fails as it cannot find those data. Is there anything to do so that instead of considering the shared addon as two separate packages the whole app and the engine consider it as one single package?

Note: I cannot convert this as a service so as to share between the engine and the app. Since there is not just one file that I want to access in that way.

If you mean you’re storing state in module scope, that works but it makes testing harder. That’s why the recommendation is to store long-lived state in services. Services can get reset automatically between tests, whereas module scoped state can’t really be reset cleanly, from the outside, given the way the ES module spec works.

But even if you want to keep using module scope, you can still share access to it via a service. If the app and engine can both see the service, and the service can see all your modules, it can act as a small bridge between them.