tbh I'd love to find root cause and provide a fix but confused which area should actually be fixed:
IMO, the patch even can be applied to @embroider/addon-dev itself as it's a real tiny change but seems it's not needed there
is it ember-auto-import or even webpack responsible for v2 addon discovery and bundling? I would guess it's ember-auto-import missing something? but where I'm not sure, any clues appreciated.
Should we just speak about elephant in the room and solely focus on Embroider? (I'm gonna extend my repro and create two branches testing what happens in case of .gts/.gjs files and in case of Embroider with .hbs)
We found out a strange issue when v2 addons are used by engines https://github.com/villander/ember-engines-router-service/issues/67
Given
ember-engines-router-service
ember-engines-router-service
listed in dependencies (alongsideember-auto-import
@2)devDependencies
Result
any entries of v2 addon listed under
addon.appReexports()
inrollup.config.mjs
file of the addon are not available for the engine.Fix competing for "mystery award of the month"
@anehx somehow came up with a tiny change in v2 addon output that fixes things https://github.com/villander/ember-engines-router-service/issues/67#issuecomment-1253285115
Minimal reproduction
Here https://github.com/SergeAstapov/v2-addons-as-deps-of-lazy-engines-repro/commits/main/ I split steps to reproduce an issue and applying fix in commits:
ember s
visiting http://localhost//dist
folder so we see what goes into result (as it's tiniest app possible with ember-cli, there are not much going on)ember s
visiting http://localhost/test-lazy-enginechunk.app
and engine has proper re-exportQuestions
tbh I'd love to find root cause and provide a fix but confused which area should actually be fixed:
@embroider/addon-dev
itself as it's a real tiny change but seems it's not needed thereember-auto-import
or evenwebpack
responsible for v2 addon discovery and bundling? I would guess it'sember-auto-import
missing something? but where I'm not sure, any clues appreciated.