-
Notifications
You must be signed in to change notification settings - Fork 28
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
gts files are left with side-effecting imports #195
Comments
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: 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 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 |
Please, re-open this issue as it is not fixed. Repro repo here with stackblitz app When stackblitz has finished launching the app, check the file This only happens with the |
I'm having the same issue here: https://github.com/lukasnys/ember-radix-ui. No matter if I use |
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 |
I confirm that using content-tag 1.1.2 fixes the issue 👍 |
Same for me, I tried updating to |
Same here: updating content-tag removed the But I just found that we have a similar issue with ember-concurrency, where a Some details
Build output [js]
[js] > [email protected] build:js
[js] > rollup --config
[js]
[types]
[types] > [email protected] build:types
[types] > glint --declaration
[types]
[js]
[js] → dist...
[js] (!) Unresolved dependencies
[js] https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency
[js] ember-concurrency/-private/async-arrow-runtime (imported by "src/components/hello.gts")
[js] ember-concurrency (imported by "src/components/hello.gts")
[js] (!) Generated empty chunks
[js] "index" and "template-registry"
[js] (!) Unused external imports
[js] task imported from external module "ember-concurrency" but never used in "src/components/hello.gts".
[js] created dist in 1.1s
[js] npm run build:js exited with code 0
[types] npm run build:types exited with code 0 Component / GTS import { task } from 'ember-concurrency';
export default class Hello extends Component<Signature> {
// ...
testTask = task({ drop: true }, async () => {
console.log('hello');
});
} Compiled / JS import { buildTask } from 'ember-concurrency/-private/async-arrow-runtime';
import 'ember-concurrency';
....
class Hello extends Component {
constructor(...args) {
super(...args);
_defineProperty(this, "testTask", buildTask(() => ({
context: this,
generator: function* () {
console.log('hello');
}
}), {
drop: true
}, "testTask", null));
} |
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: universal-ember/ember-primitives#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
The text was updated successfully, but these errors were encountered: