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.
This is really https://github.com/embroider-build/ember-auto-import/issues/611, but opening an issue here for visibility
In a classic app build with
.gts
, this works:But this does not:
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-effectfulimport "ember-truth-helpers";
in yourapp.ts
or something would also have the same effect.