New Aurelia user: silly behavioral question

Hey all! I’m just getting started and walking through the docs.

I’m trying to simply include a component from my top-level app, and it doesn’t appear to create an instance of the viewModel, but does display the view. Trying to figure out if I just have a bad assumption about some of Aurelia’s magic, or if something else is wonky in my environment. (This was via the npm makes skeleton.)

The subcomponent viewModel itself is probably irrelevant boilerplate, for testing I’m just emitting to the console in the constructor - and nothing shows up.

This is via a <import from="./component/sub-component"></import> within the main view. My expectation would be that it finds sub-component.js and sub-component.html, and links them together.

This -does- work as I’d expect if I import using the extension: <import from="./component/sub-component.js"></import>. Everything seems happy, but I don’t see that usage behavior as such in the docs.

Can someone set me straight? :slight_smile:

Edit: forgot to include that this is 2.0.0-beta.1.

1 Like

Hey, I tried to replicate this but could not.

In the example, my-app imports my-component and my-component imports my-sub-component


<import from="./my-component"></import>



<import from="./my-sub-component"></import>

  <div>This is the component</div>


Works as expected. Using <import from="./my-component"></import> both my-component.ts and my-component.html are imported.

Hey, thanks for the response, good to hear my expectations are at least correct!

Could there be any difference between regular javascript and typescript? Only thing I can call out as a difference at the moment.

1 Like

Tried with your project example, and a js variant of it – and both worked just fine. Going through my shell history, I forgot when I set this up that there was another notable difference (I neglected to include!)

I was using parcel, not webpack. npx makes aurelia project -s parcel.

Making a fresh project with parcel, I can reproduce the issue. Without, and all is good. Hm.

Ah ok, makes sense. I can confirm. Also tried it with the parcel setting. Getting same results as you. I think this is not an issue with Aurelia, but an issue with @aurelia/parcel-transformer. Might be worth it to create a Github issue.

1 Like

Appreciate the confirmation, and done!

1 Like