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

Support strict embroider builds #647

Closed
wants to merge 4 commits into from

Conversation

mike-engel
Copy link
Contributor

Potential solution for #594, alternative for #633.

Should also fix #642.

This uses the macroDependencySatisfies helper and brings back ensure-safe-component

@mike-engel mike-engel marked this pull request as ready for review November 28, 2023 15:16
@mike-engel mike-engel changed the title Fix embroider Support strict embroider builds Nov 28, 2023
@@ -1,4 +1,4 @@
{{#if this.useElementHelper}}
{{#if (macroDependencySatisfies 'ember-element-helper' '^0.6.1')}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mike-engel how would this work for ember-element-helper higher versions like v0.7 and v0.8?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build still fails with the same error like #455 (and #633 which is the same thing)

Error: Attempted to resolve `macroDependencySatisfies`, which was expected to be a helper, but nothing was found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mike-engel how would this work for ember-element-helper higher versions like v0.7 and v0.8?

Thanks for catching this. This was a lazy copy/paste from the getter 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergeAstapov I wonder if this is a bug or just expected behavior? This matrix is out of date (I think), but macroDependencySatisfies has no runtime function. Additionally, the docs explicitly say that dead branches are only removed on production builds:

The macroCondition macro allows branch level code isolation (and deletion in the case of production builds)

So either there's a bug where ember classic builds (although, this is still happening on my embroider build, too) aren't actually replacing code, or this is as expected. I'd assume the former, but I've no idea how to test that theory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I guess macros without a runtime should always be pruning branches: embroider-build/embroider#1468

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be that embroider-build/embroider#1468 only fixed the javascript macroCondition and not the handlebars one. If so, we should fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My (maybe naive) fix for templates: embroider-build/embroider#1688

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, I think macroCondition (macroDependencySatisfies 'ember-element-helper' '>=0.6.1') should also work if that PR doesn't get accepted

@villander
Copy link

@SergeAstapov is there anything I can help to get it merged and released?

@SergeAstapov
Copy link
Collaborator

@villander this fix is not working, hence it's not ready to be merged

@mike-engel
Copy link
Contributor Author

@villander @SergeAstapov I've decided that macros are too buggy right now, and opened #657 to drop support for the old version of ember-element-helper instead.

@mike-engel
Copy link
Contributor Author

Closing in favor of #657

@mike-engel mike-engel closed this Dec 11, 2023
@mansona
Copy link

mansona commented Dec 15, 2023

@mike-engel just to let you know we released your PR to embroider in https://github.com/embroider-build/embroider/releases/tag/v4.1.3-%40embroider%2Faddon-dev in case you want to try this approach again?

@mike-engel mike-engel deleted the fix-embroider branch December 16, 2023 09:34
@mike-engel
Copy link
Contributor Author

@mansona I think since #657 has been accepted, that would trump this PR anyway. If this PR is still desired I can try again, but I don't think it's worth it

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

Successfully merging this pull request may close these issues.

Error after upgrade from 1.0.4 to 1.1.0
5 participants