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

Cannot resolve macroCondition #1745

Open
SanderKnauff opened this issue Dec 28, 2023 · 1 comment
Open

Cannot resolve macroCondition #1745

SanderKnauff opened this issue Dec 28, 2023 · 1 comment

Comments

@SanderKnauff
Copy link

I'm currently porting an addon to the V2 package format. During this I encountered an issue with the macro helpers.

Error: Attempted to resolve `macroCondition`, which was expected to be a helper, but nothing was found.
    at resolveHelper (http://localhost:4200/assets/vendor.js:28257:15)
    at encodeOp (http://localhost:4200/assets/vendor.js:30101:18)
    at pushOp (http://localhost:4200/assets/vendor.js:30036:7)
    at http://localhost:4200/assets/vendor.js:28458:7
    at Compilers.compile (http://localhost:4200/assets/vendor.js:28443:7)
    at expr (http://localhost:4200/assets/vendor.js:28601:19)
    at http://localhost:4200/assets/vendor.js:28565:5
    at Compilers.compile (http://localhost:4200/assets/vendor.js:28443:7)
    at expr (http://localhost:4200/assets/vendor.js:28601:19)
    at http://localhost:4200/assets/vendor.js:29821:7

It seems that when a consumer builds the app, helper macros are not being detected properly. Function based macros seem to work as intended.

I have a reproduction of the issue in the following repository:
https://github.com/SanderKnauff/v2-macro-repro

Running the tests will reveal that the call macroCondition still exists in the template after build time. Inspecting the bundle of the function macro reveals that that one did get compiled away.

@ef4
Copy link
Contributor

ef4 commented Jan 9, 2024

I think the ember-auto-import support for template macros in v2 addons is commented out here: https://github.com/embroider-build/ember-auto-import/blob/cccb8b1a5033272f32d65a00fdf33e1c05b8698d/packages/ember-auto-import/ts/package.ts#L575C13-L575C62

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

2 participants