ember-math-helpers icon indicating copy to clipboard operation
ember-math-helpers copied to clipboard

Tree-shaking via only / except configuration is broken in v4

Open jelhan opened this issue 1 year ago • 5 comments

The tree-shaking via only and except configuration options does not seem to work anymore in 4.0.0. I think it was dropped when converting the addon to v2 in #945.

I assume this was done by accident as the feature is still documented: https://github.com/RobbieTheWagner/ember-math-helpers/blob/f7c0446d05558a1a700f27a0565f370e9471eab5/docs/docs/configuration.md?plain=1#L1-L19

This breaking change is also not listed in the changelog: https://github.com/RobbieTheWagner/ember-math-helpers/blob/f7c0446d05558a1a700f27a0565f370e9471eab5/CHANGELOG.md?plain=1#L6-L24

I noticed this when investigating if we can convert Ember Bootstrap to a v2 addon without dropping support for tree-shaking through configuration.

jelhan avatar Jan 02 '24 17:01 jelhan

@jelhan you are correct that support was dropped for it. I believe tree shaking should be automatic with embroider and only use the things you import, but I could be wrong.

RobbieTheWagner avatar Jan 05 '24 02:01 RobbieTheWagner

I believe tree shaking should be automatic with embroider and only use the things you import, but I could be wrong.

That's only true if consuming app uses Embroider and opted in to { staticHelpers: true } as far as I know.

jelhan avatar Jan 05 '24 10:01 jelhan

I believe tree shaking should be automatic with embroider and only use the things you import, but I could be wrong.

That's only true if consuming app uses Embroider and opted in to { staticHelpers: true } as far as I know.

That's possible, but that is the future, so I don't know if we need configs for this anymore in this addon.

RobbieTheWagner avatar Jan 05 '24 18:01 RobbieTheWagner

I don't know if we need configs for this anymore in this addon.

I think it's a maintainer decision. I see two options:

  1. Document the breaking change in the changelog and update the docs. Or
  2. Rollback the v2 addon conversion and restore the functionality as a bug fix.

A third one would be restoring the functionality for apps not using Embroider. This is discussed here: https://github.com/embroider-build/embroider/issues/1748#issuecomment-1875698206 It would be still a breaking change introduced in v4 but affecting a smaller subset of apps using this addon.

jelhan avatar Jan 05 '24 20:01 jelhan

I think documenting the breaking change is probably the best way to go here.

RobbieTheWagner avatar Jan 07 '24 20:01 RobbieTheWagner