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 an ESM-based config file #3

Open
simonihmig opened this issue Jan 20, 2024 · 0 comments
Open

Support an ESM-based config file #3

simonihmig opened this issue Jan 20, 2024 · 0 comments

Comments

@simonihmig
Copy link
Owner

I tried to see if we can support the config file proposed in this experimental addon to be ESM-based (i.e. config/addons.mjs). However I failed to do so.

AFAIU, the constraints here are:

  • our "addon-main" module (index.js) has to be CJS
  • you cannot require() an ESM module from CJS
  • you can do so using import(), but that makes it async
  • as it seems, you cannot use that when this would need to happen synchronously during the included hook (that's also when @embroider/macros does all its Ember-CLI plumbing work). When done asynchronously (trying that here), the setConfig() calls seems to happen too late in time to have an effect

So without introducing support for async included in EmberCLI itself, I wouldn't know how to make this work with the constraints we have here!? 🤔

Also, when looking at upstreaming this feature to @embroider/macros, I wouldn't know if that makes things any easier, as again the blocker seems that we have to do the setup work synchronously within the included hook...

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

1 participant