You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm hunting a NPE for quite some time now - might be related to #1108
Cannot read properties of undefined (reading 'registerV2Addon')
I may have found a fix, but cannot be sure about this 100% yet - but enough to share here already.
The Situation
I'm upgrading hokulea to addons-v2. And with these addons v2 I see the error message above. Here is the monorepo and the dependency tree of relevant addons:
These are the noticable v2 addons, that will go through @embroider/addon-shim.
The Problem
Starting ember serve in @hokulea/ember-actions-test-app shows the error, that happens when an addon v2 depends on an addon v2 depends on an addon v2 - Two levels is the "threshold" here.
Why I'm saying this is only a suggested fix: I'm not sure, if this piece of code is in the intention of the comment or if that means a different implementation (given I have basically no real knowledge about embroider).
What I can say, this makes my build passes this step - I have errors later on, so I cannot be sure as well.
This is ready enough for me for now to share. If my suggested fix is enough, then cool. If not a hint would be nice, so the next time I'm working on this, I can continue digging into it.
The text was updated successfully, but these errors were encountered:
I'm hunting a NPE for quite some time now - might be related to #1108
I may have found a fix, but cannot be sure about this 100% yet - but enough to share here already.
The Situation
I'm upgrading hokulea to
addons-v2
. And with these addons v2 I see the error message above. Here is the monorepo and the dependency tree of relevant addons:These are the noticable v2 addons, that will go through
@embroider/addon-shim
.The Problem
Starting
ember serve
in@hokulea/ember-actions-test-app
shows the error, that happens when an addon v2 depends on an addon v2 depends on an addon v2 - Two levels is the "threshold" here.Reason for this in this line:
embroider/packages/addon-shim/src/index.ts
Line 77 in aa97453
which calls this method:
embroider/packages/addon-shim/src/index.ts
Lines 161 to 163 in aa97453
Now
autoImportInstance
is set in the code block linked above. Here is the trace in prose:@hokulea/ember-actions
(in the tree above).@hokulea/ember-actions
has the chance to register its direct v2 addons (ember-modifer
+@hokulea/ember-foundation
).@hokulea/ember-foundation
thisautoImportInstance
isundefined
@hokulea/ember-foundation
throws the error aboveGiven
autoImportInstance
is a local variable not "deeply" available, which makes sense and the reason for two levels being the thresholdundefined
💣The Suggested Fix
The fix is mentioned in the comment:
embroider/packages/addon-shim/src/index.ts
Lines 75 to 76 in aa97453
but not applied, it is not thrown "higher and higher". The fix would target
registerV2Addon()
method:Why I'm saying this is only a suggested fix: I'm not sure, if this piece of code is in the intention of the comment or if that means a different implementation (given I have basically no real knowledge about embroider).
What I can say, this makes my build passes this step - I have errors later on, so I cannot be sure as well.
This is ready enough for me for now to share. If my suggested fix is enough, then cool. If not a hint would be nice, so the next time I'm working on this, I can continue digging into it.
The text was updated successfully, but these errors were encountered: