Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 addons are not bundled when listed in dependencies of lazy-loading engine (weirdo fix attached) #619

Open
SergeAstapov opened this issue Apr 2, 2024 · 0 comments

Comments

@SergeAstapov
Copy link
Contributor

We found out a strange issue when v2 addons are used by engines villander/ember-engines-router-service#67

Given

  • v2 addon ember-engines-router-service
  • an engine where ember-engines-router-service listed in dependencies (alongside ember-auto-import@2)
  • an app, that has an engine in devDependencies

Result

any entries of v2 addon listed under addon.appReexports() in rollup.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 villander/ember-engines-router-service#67 (comment)

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:

  1. just creating a minimal test app: it boots and runs via ember s visiting http://localhost/
  2. checked in /dist folder so we see what goes into result (as it's tiniest app possible with ember-cli, there are not much going on)
  3. created a minimal test engine, and injected it into test app from step 1: engine boots and runs via ember s visiting http://localhost/test-lazy-engine
  4. created a minimal v2 addon that exports single tiny component: it's referenced in engine but it does not get bundled into /dist folder anywhere
  5. applied small patch via pnpm and now v2 addon code at least gets bundled into chunk.app and engine has proper re-export

Questions

tbh I'd love to find root cause and provide a fix but confused which area should actually be fixed:

  1. 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
  2. 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.
  3. 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant