Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Compatibility with ember-auto-import #2

Open
alexlafroscia opened this issue Nov 18, 2020 · 2 comments
Open

Compatibility with ember-auto-import #2

alexlafroscia opened this issue Nov 18, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@alexlafroscia
Copy link
Owner

alexlafroscia commented Nov 18, 2020

ember-auto-import currently assumes that ember-cli-babel is present in the host application. Babel is used by ember-auto-import to parse the files in your application and find the imports.

https://github.com/ef4/ember-auto-import/blob/e7d34659666ece3a33c822971e12720680b86c89/packages/ember-auto-import/ts/analyzer.ts#L144

The host application's Babel configuration is used to ensure that ember-auto-import processes files with any custom configuration you might have applied to Babel (for things like custom syntax, I assume).

I have opened an issue on ember-auto-import to see if there's a path forward. That issue can be found here:

embroider-build/ember-auto-import#317

Two general ideas I've had are:

  1. Expose whatever is needed from this addon so that it could be used to parse the files instead of Babel
    • I'm not sure how much this would make sense, as I do not think that esbuild provides a parsing API
  2. Use some default Babel configuration inside ember-auto-import if ember-cli-babel is not present in the host app
    • Since esbuild does not support plugins at this time, it's likely we could make some assumptions about the syntax of the files so that they can be parsed by ember-auto-import using a pre-defined Babel configuration that would work with esbuild
    • This could get tricky around TypeScript support

With how important ember-auto-import is to the modern Ember ecosystem, I see this as a blocker to an initial release of these packages.

@alexlafroscia alexlafroscia added this to the Initial Release milestone Nov 18, 2020
@vlascik
Copy link

vlascik commented Mar 16, 2021

There now is a babel plugin for esbuild at https://github.com/nativew/esbuild-plugin-babel

@alexlafroscia
Copy link
Owner Author

Hmm, that's interesting!

So maybe we could use esbuild plus the legacy decorators plug-in... I'll have to check that out!

@alexlafroscia alexlafroscia added the bug Something isn't working label Mar 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants