Closed doktordirk closed 6 years ago
I now found that information in an older blog post. Had it been in the wiki it would have saved me some trouble.
Would you like to provide a pull request for it @doktordirk ?
öhm, well, actually, i kinda tried, but was too stupid to do that for the wiki pages. seems tricky to do that, hence i just added it here, so eg you can add it. i don't care about 'authorship' too much
@jods4 ?
Thanks for your contribution, it's been added to the wiki.
I took the liberty to change the text a bit, especially the second code example which contained an unnecessary duplicated string.
I had some struggle with PLATFORM.moduleName and hence i'd propose to add some explanation about the internals to the wiki pages
Managing Dependencies
How it works
PLATFORM.moduleName
is actually not used for runtime reference, but it gets statically analyzed by theaurelia-webpack-plugin
at compile time to include your module in the build and make a reference database with the module name you use to the reference theaurelia-webpack-loader
needs. Hence, you have to use string literals and following won't work:In the rare case, you want to add a resource to aurelia using a variable, you can do that if you have registered it somewhere using PLATFORM.moduleName with a string literal. So following wouldn't be recommended, but does work:
HTML dependencies
A few Aurelia tags can dynamically load modules, like:
<require from=...>
<compose view=... viewModel=...>