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

Fix compatibility with ember-cli-babel@7.26+ #362

Merged
merged 3 commits into from
Apr 16, 2021

Conversation

rwjblue
Copy link
Collaborator

@rwjblue rwjblue commented Mar 18, 2021

ember-cli-babel@7.24 fixed a bug where the buildBabelOptions result included a number of non-babel specific properties (reported in emberjs/ember-cli-babel#227). Unfortunately, while we were explicitly working around that bug (the delete's in the snippet here) but we also ended up relying on it with the usage of filterExtensions property.

In order to make it possible for ember-auto-import to have a path forward, ember-cli-babel@7.26.0 introduces a new public API to get a list of the supported extensions (babelAddon.getSupportedExtensions).

This PR uses the presence of the getSupportedExtensions function to decide if it needs to clear the abnormal properties or not, and fixes usage of ember-auto-import along with ember-cli-babel@7.26+.

Fixes #359
Fixes emberjs/ember-cli-babel#389

ember-cli-babel@7.24 fixed a bug where the `buildBabelOptions` result
included a number of non-babel specific properties. Unfortunately,
while we were explicitly working around that bug (the `delete`'s in the
snippet here) but we **also** ended up relying on it with the usage of
`filterExtensions` property.

In order to make it possible for ember-auto-import to have a path
forward, ember-cli-babel@7.26.0 introduces a new public API to get a
list of the supported extensions (`babelAddon.getSupportedExtensions`).

This PR uses the presence of the `getSupportedExtensions` function to
decide if it needs to clear the abnormal properties or not, and fixes
usage of ember-auto-import along with ember-cli-babel@7.26+.
let babelOptions, extensions;

if (typeof babelAddon.getSupportedExtensions === 'function') {
babelOptions = babelAddon.buildBabelOptions('babel', options);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added this new signature so that I could make the default invocation without arguments (or options) passed return the broccoli-babel-transpiler style options.

@ef4
Copy link
Collaborator

ef4 commented Mar 23, 2021

Now that the test updates have landed, we can probably just update the ember-cli-babel version in app-template to the new one, and add a new test scenario that explicitly covers the old one. The old one can become an aliased dependency in the test-scenarios package.

@ef4 ef4 merged commit 3090a28 into embroider-build:master Apr 16, 2021
@rwjblue rwjblue deleted the fix-with-new-babel branch April 16, 2021 15:07
@ef4
Copy link
Collaborator

ef4 commented May 5, 2021

This is breaking ember-auto-import 2.0.0-beta.1 due to emberjs/ember-cli-babel#401.

I'm going to revert it and rely on the backward compatible call signature instead.

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.

Dependencies in .ts files not included with latest ember-cli-babel 7.24.0+ Breaks everything
2 participants