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

V1Addon with ember-source@3.28 does not work with App with ember-source@v3.25 #431

Open
NullVoxPopuli opened this issue Jan 11, 2022 · 14 comments

Comments

@NullVoxPopuli
Copy link
Contributor

I think it's because addons are resolving their capabilities local to them rather than the host app.
because setComponentTemplate (used in the output of co-located components), is referenced as Ember._setComponentTemplate in the app, and in the addon, referenced as: _component.setComponentTemplate (an import from the module (and real modules don't exist until ember-source@3.27)).

shouldn't ember-cli-babel ignore whatever is going on in the addon, and determine ember-source version from the host app?

@sly7-7
Copy link

sly7-7 commented Jan 11, 2022

specifically, I think this works with app with ember-source@3.25.3, but not with app with ember-source@3.25.4

@NullVoxPopuli
Copy link
Contributor Author

I'll try 3.25.3 before attempting a PR

@NullVoxPopuli
Copy link
Contributor Author

I have the same problem on 3.25.3

@rwjblue
Copy link
Member

rwjblue commented Jan 11, 2022

I don't understand the thing being reported here, can you be more specific? Have a reproduction?

@NullVoxPopuli
Copy link
Contributor Author

trying to get debug-info atm -- giving up on vscode on this machine 🙃

@NullVoxPopuli
Copy link
Contributor Author

The surface issue I'm trying to address is this error:

Could not find module @ember/component imported from (my module)

@NullVoxPopuli
Copy link
Contributor Author

ok, so after a bunch of debugging, I've determined that in booting my app,

  • every useModulesVersion usage is false (expected)` except when ember-source itself is building
    • same for the including the transform modules api babel plugin
      this is tied to this setting
      image
      which makes me thing this is intended behavior (and I gotta look elsewhere)
  • all invocations of emberVersionRequiresModulesAPIPolyfill return true (expected)

Odbservations:

  • @embroider/macros is involved pretty early on in the call stack, almost immediately after calling app.toTree() in the app's ember-cli-build.js
  • ember is building itself via buildEmberBundles
    this ember version matches the expected version (in monorepo, app has 3.25.4, addon has 3.28.8)
    <app> on  <branch> 
    ❯ cat <path-to-root>node_modules/ember-source/package.json | jq '.version'
    "3.25.4"
    
    <app> on  <branch> 
    ❯ cat <path-to-root>/<addon-path>/node_modules/ember-source/package.json | jq '.version'
    "3.28.8"

Observations

  • any time my conditional breakpoint(s) are hit (only thee times? (once for packages, dependencies, and headers)), I'm in the vendor tree (which makes sense, because ember-source is getting built)
  • all my breakpoints behave the same and have the same information in scope between a worktree that has a 3.28.8 addon in the monorepo and a worktree (upstream) that does not have 3.28.8

@rwjblue
Copy link
Member

rwjblue commented Jan 11, 2022

can you make a repro? would it be a monorepo with two ember-source versions?

@NullVoxPopuli
Copy link
Contributor Author

Seems related to: emberjs/ember.js#19700

can you make a repro? would it be a monorepo with two ember-source versions?

yup, can do! 🎉

@NullVoxPopuli
Copy link
Contributor Author

yup, can do!

turns out, it's not so easy!
I'll have to compare my repro with whatever is going on with my work monorepo tomorrow

@NullVoxPopuli
Copy link
Contributor Author

@sly7-7
Copy link

sly7-7 commented Jan 12, 2022

Seems related to: emberjs/ember.js#19700

I just discover this issue, exact same for me, not working when my addon is linked (via yarn), but it works when referring the published addon.

@betocantu93
Copy link

I'm facing this issue too, here's a repro https://github.com/prysmex/ember-eui/tree/update-3.24.0

  1. yarn
  2. cd site
  3. ember s

If you downgrade packages/core from ~3.27.2 to 3.26.2 it should work.

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

4 participants