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

Importing from package root does not work in classic builds + .gts #206

Open
chancancode opened this issue Mar 8, 2024 · 0 comments
Open

Comments

@chancancode
Copy link

This is really embroider-build/ember-auto-import#611, but opening an issue here for visibility

In a classic app build with .gts, this works:

import and from 'ember-truth-helpers/helpers/and';

export default <template>{{if (and true true) "true true"}}</template>;

But this does not:

import { and } from 'ember-truth-helpers';

export default <template>{{if (and true true) "true true"}}</template>;

The reason is that (h/t @patricklx) the babel TypeScript plugin does not see the values inside the template tags as being "used" (likely because it is still in the eval() form), so that it drops the imports and prevents ember-auto-import's analyzer from "seeing" them.

This actually happens in both cases! However because of the "app-re-export" (v1 shim), the addons/* modules are forced into the build/the AMD registry regardless of whether they are used, so then it accidentally works. By that logic I think adding a side-effectful import "ember-truth-helpers"; in your app.ts or something would also have the same effect.

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