Open NullVoxPopuli opened 1 year ago
Having a hard time reproducing the example -- it appears to have something to do with my code, as my simple examples don't reproduce the issue, but when I copy my addon's src folder into the default v2 addon blueprint output, the issue reproduces.
I have a repro using the v2 addon blueprint here: https://stackblitz.com/edit/stackblitz-starters-qner5x?
output dist/index.js
import '@glint/template';
import Component from '@glimmer/component';
class Hello extends Component {}
export { Hello };
//# sourceMappingURL=index.js.map
It happens when you forget import type
!!
So,
import type { Thing } from 'whatever';
will be fully removed
but
import { type Thing } from 'whatever';
will not be.
so we probably need a lint to prefer the import type
Please, re-open this issue as it is not fixed.
Repro repo here with stackblitz app https://github.com/bartocc/stackblitz-starters-pyxvkz
When stackblitz has finished launching the app, check the file my-addon/dist/index.js
, it'll contain the culprit import '@glint/template';
This only happens with the .gts
extension.
Change my-addon/src/index.gts
to my-addon/src/index.ts
and the bug is gone
I'm having the same issue here: https://github.com/lukasnys/ember-radix-ui.
No matter if I use import { WithBoundArgs } from '@glint/template';
, import type { WithBoundArgs } from '@glint/template';
or import { type WithBoundArgs } from '@glint/template';
. The import '@glint/template';
in the dist remains causing the consuming test-app to crash.
Made a stackblitz of the above repo if folks don't want to clone: https://stackblitz.com/edit/github-yl7xy1?file=packages%2Faccordion%2Fsrc%2Fcomponents%2Faccordion.gts&file=packages%2Faccordion%2Fdist%2Fcomponents%2Faccordion.js
resolved by ensuring that content-tag
in your lockfile is up to date (at least 1.1.2).
This'll be fixed shortly with a new minimum @embroider/addon-dev
version.
I confirm that using content-tag 1.1.2 fixes the issue 👍 thx @NullVoxPopuli and @ef4 for the fix 👍
Same for me, I tried updating to content-tag@1.1.2
in the Stackblitz example @NullVoxPopuli provided and then it's fixed 👍. Thanks!
Same here: updating content-tag removed the import '@glint/template'
line, thanks :clap:!
But I just found that we have a similar issue with ember-concurrency, where a import 'ember-concurrency';
remains in the compiled output... is it maybe related or should it be addressed in EC?
yeah, sounds like a bug in their babel plugin -- they have enough knowledge of what they need to do to remove that themselves (babel can't do it, because it's not safe), but ember-concurrency knows that there is no reason to use a side-effecting import from itself.
I currently get this messaging in my rollup build when updating to the latest blueprint:
Repro here: https://github.com/universal-ember/ember-primitives/pull/114
Example output:
The main issue being the remaining
import @glint/template
-- which is a type-only package, and in the real code, I have:So the whole thing should be removed in the emitted js