Closed charlessolar closed 6 years ago
<compose view-model>
is only processed if it's static.
For example in your case we don't try to pull every possible file in test/**/*
. That would work but could also quickly pull in unwanted stuff (there's a way to do that if you want, though).
There's a full discussion of dynamic compose and several options in this issue: aurelia/skeleton-navigation#810. I'm sorry there are lots of comments over there. I want to write a page about this in the wiki but haven't come to do so yet. Look at my first answer for a good starting point.
As this is a duplicate of that other issue I'm going to close this but feel free to comment if you found an acceptable solution over there or not.
The listed solutions will work for me - but I'm surprised its not in the docs because its been confusing. Not being an expert in webpack I was sure webpack was not including the module but had no idea how this plugin was handing dynamic composition.
Issue is over in skeleton navigation of all places too - well now at least there's another link to it for future people.
Yeah, sorry about that,. I have a list of 6 topics scattered in issues that I want to add to the wiki this being one of them. Just need to find some time to redact them.
Glad it worked out for you.
I'm seeing maybe a previously reported issue: #56 except in my case dynamic compose doesn't work at all.
I forked and modified the skeleton-typescript-webpack to illustrate https://github.com/volak/aurelia-compose-issue
The problem is in welcome.html line
<compose view-model="test/${selectedTest}"></compose>
Webpack reports
Unhandled rejection Error: Unable to find module with ID: test/hello
I'm sure its something to do with
test/hello
not being included because its never referenced or something - but from other comments in similar dynamic composition issues this should be supported I believe?