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

Cannot dynamically import a component with allowAppImports #618

Open
boris-petrov opened this issue Apr 1, 2024 · 0 comments
Open

Cannot dynamically import a component with allowAppImports #618

boris-petrov opened this issue Apr 1, 2024 · 0 comments

Comments

@boris-petrov
Copy link
Contributor

boris-petrov commented Apr 1, 2024

That is, it seems to only import the JavaScript part of the component while the HBS is not.

Example - say I have a my-app/components/dynamic/foo-bar.js (a Glimmer component) and a my-app/components/dynamic/foo-bar.hbs for it. In ember-cli-build.js I put allowAppImports: ['components/dynamic/*']. Doing import('my-app/components/dynamic/foo-bar').then(module => module.default) will only load the js file. So rendering that will lead to an empty screen.

I'm not sure how that could be resolved. The only thing I can think of now is that I have to write a webpack loader for HBS files (which somehow uses the template-compiler to compile the HBS), import the HBS in addition to the JS and then use setComponentTemplate to wire them up.

See here for a bit of discussion.

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