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

Incompatibility with ember-element-helper v0.6.1 and Embroider optimized #594

Closed
jelhan opened this issue Feb 18, 2023 · 8 comments
Closed

Comments

@jelhan
Copy link

jelhan commented Feb 18, 2023

Describe the bug

Ember Animated breaks the build if used with Embroider optimized configuration and [email protected]:

Missing helper: -element in node_modules/ember-animated/dist/components/animated-container.js

The issue is caused by trying to resolve a -element helper, which does not exist if using [email protected].

The issue only exists if using Embroider optimized. Ember Animated already detects at run-time if element or -element helper is available.

{{#if this.useElementHelper}}
{{!--
The @class is only there to support a deprecated usage.
--}}
{{#let (element this.tag) as |Tag|~}}
<Tag class="animated-container {{@class}}" ...attributes>
{{yield}}
</Tag>
{{/let}}
{{else}}
{{!--
The @class is only there to support a deprecated usage.
--}}
{{#let (component (ensure-safe-component (-element this.tag)) tagName=this.tag) as |Tag|~}}
<Tag class="animated-container {{@class}}" ...attributes>
{{yield}}
</Tag>
{{/let}}
{{/if}}

Based on build-time configuration depending on used ember-element-helper version.

get useElementHelper() {
return dependencySatisfies('ember-element-helper', '^0.6.1');
}

Bit if using Embroider optimized, the correct helper must be chosen on build-time already. A run-time switch is too late as Embroider / Webpack tries to resolve the helper already at build-time if using staticHelpers configuration.

Downgrading to [email protected] solves the issue.

To Reproduce

I created a reproduction here: https://github.com/jelhan/test-ember-animated-with-embroider-optimized

The error described above is shown in CI pipeline of main branch.

The following PR shows that it could be solved by downgrading ember-element-helper to 0.6.0.

Additional context

It seems that @SergeAstapov started working on a big fix in #455 and #429. But it went stale.

@cah-brian-gantzler
Copy link

cah-brian-gantzler commented Jul 7, 2023

Just ran in a very similar issue. This time it was ember-element-helper coming from https://github.com/cibernox/ember-power-select - ember-basic-downdown which brought in 0.6.1. When resolving to 0.6.0 code again works under embroider full compat mode.

@rogeraraujo90
Copy link

I'm seeing this issue in my project too. I'm updating from Ember 3.28 to Ember 4.4. Adding resolution to ember-element-helper is an effective workaround. Thanks, @jelhan

@NullVoxPopuli
Copy link
Contributor

anyone want to give this a go? #633

@mike-engel
Copy link
Contributor

I'm now wondering if it would be easier to drop support for ember-element-helper@<0.6.1 and publish a new major version of this package?

@jelhan
Copy link
Author

jelhan commented Nov 28, 2023

Isn't this fixed already?

"ember-element-helper": ">=0.5.0"

@NullVoxPopuli
Copy link
Contributor

Nay, the issue is that -element doesn't exist as a helper and breaks statically analyzed builds.

@jelhan
Copy link
Author

jelhan commented Nov 29, 2023

Nay, the issue is that -element doesn't exist as a helper and breaks statically analyzed builds.

Should have read my own issue description more carefully. Thanks for clarifying.

It seems @SergeAstapov picked up #455 again. That seems to be the correct path forward on case we want to support ember-element-helper <= 6.0.0 and ember-element-helper >= 6.1.0 in parallel. This would for sure ease upgrades to consumers. But if we run into issues we should just drop support for ember-element-helper < 6.1.0 and move forward.

@SergeAstapov
Copy link
Collaborator

this should be fixed in v2.0.0

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

6 participants