Closed HenryVonfire closed 5 years ago
Thanks so much for putting together that reproduction, @HenryVonfire! I'm traveling the next few days, but will pull it down and take a look as soon as I get the opportunity.
Ok, this is pretty interesting:
.js
and .ts
files, regardless of the presence or absence of any actual TypeScript syntaxbabel-plugin-transform-typescript
in the Babel plugin configEmber._setComponentTemplate
doesn't get called if the TS plugin is present@babel/plugin-transform-typescript
@babel/plugin-transform-typescript
The only difference I see is the _setComponentTemplate
line. I can't think of any reason the TS syntax plugin should be affecting whether colocated-babel-plugin
would find the default export (since it doesn't touch module syntax at all, afaik). @rwjblue do you have any thoughts on what might be happening?
Well. 🤦♂
Stopped in the debugger after the file's been processed we have this:
var _class, _descriptor, _temp;
const __COLOCATED_TEMPLATE__ = Ember.HTMLBars.template(/* snip */);
import Component from "@glimmer/component";
let TestCompComponent = (_class = (_temp = class TestCompComponent extends Component {
/* snip */
}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "testProperty", [Ember._tracked], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
})), _class);
export { TestCompComponent as default };
That last line would explain why the ExportDefaultDeclaration
visitor is never hit 😭
Great work @HenryVonfire & @dfreeman, we can fix things up in the babel transform. Will try to get that done today...
@rwjblue I'm working on it now—just getting some tests in place 🙂
OK, awesome thank you!
@dfreeman thanks a lot for looking into this. It's amazing how fast you found the bug!
Thanks to @dfreeman, @HenryVonfire, and @josemarluedke, this should now be fixed and released in v4.0.7.
Please test / confirm...
I just confirmed that v4.0.7 did fix the issues I have been seeing. Thanks, @dfreeman, @HenryVonfire, @rwjblue.
I can confirm it works too. I'll close this issue. Thanks @dfreeman, @rwjblue, and @josemarluedke
ember version
ember-cli: 3.13.1
node: 10.11.0 os: win32 x64
tsc version
Version 3.1.1
ember-cli-typescript
andember-cli-typescript-blueprints
versionsember-cli-typescript@3.0.0 ember-cli-typescript-blueprints@3.0.0
Reproduction Case
As @dfreeman suggested me, here is a reproduction of the unexpected behaviour I encountered with a new octane app:
Link: repository
The repository in the link has the bare minimum to reproduce the unexpected behaviour. It's a new octane project with a glimmer component using colocation. The component works as long as no decorators are used inside. If a single decorator is used (for example it has a
@tracked
property), then the component is not rendered without throwing any error.Removing the files and packages added by
ember-cli-typescript
makes the component work with decorators.