neomjs / neo

The application worker driven frontend framework
https://neomjs.com
MIT License
2.86k stars 160 forks source link

Neo.setupClass() => create a protection for not creating singleton instances more than once #5512

Closed tobiu closed 3 months ago

tobiu commented 3 months ago

The current singleton implementation works fine, in case we are sticking to one Neo.mjs version per app.

For the LivePreview, the dynamic code can not be bundled, so when trying to build the Portal app, it could happen that we have both, the dist/production and the development versions of neo in parallel.

In this case, singleton files will get pulled in from multiple locations (file-paths). setupClass() needs to check if the namespace already exists and if so, not create a new instance or override the ns.