We've created a plugin, and its local demo works.
https://github.com/shaunluttin/aurelia-open-id-connect/tree/master/src
Installing the plugin into another project, though, fails with this sequence of two errors, which are complaining about the open-id-connect-user-block.html
view/view-model component.
Uncaught TypeError: plugin.load is not a function
Unhandled rejection Error: Load timeout for modules: template-registry-entry!aurelia-open-id-connect/open-id-connect-user-block.html_unnormalized2,template-registry-entry!aurelia-open-id-connect/open-id-connect-user-block.html,text!aurelia-open-id-connect/open-id-connect-user-block.html_unnormalized3,text!aurelia-open-id-connect/open-id-connect-user-block.html http://requirejs.org/docs/errors.html#timeout
What we have tried
Add the component as a global resource in our plugin's configure
function.
function configure(config: FrameworkConfiguration, callback: Function) {
config.globalResources("./open-id-connect-user-block");
}
Add the plugin in the consuming application's configure
function.
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.plugin("aurelia-open-id-connect", (callback) => callback(oidcConfig));
aurelia.start().then(() => aurelia.setRoot());
}
Add the plugin in the consuming application's aurelia.json
file.
"bundles": [
{
"name": "open-id-bundle.js",
"dependencies": [
"oidc-client",
{
"name": "aurelia-open-id-connect",
"path": "../node_modules/aurelia-open-id-connect/dist/amd/es5/open-id-connect",
"main": "index"
}
]
},
// other bundles
]
Set the requirejs/text
plugin to stub:false
.
"plugins": [
{
"name": "text",
"extensions": [
".html",
".css"
],
"stub":false
}
That creates a 404 new error:
Unhandled rejection Error: src/../node_modules/aurelia-open-id-connect/dist/amd/es5/open-id-connect/open-id-connect-user-block.html HTTP status: 404
What we have read
We have seen this issue on GitHub: Installing normal Aurelia plugins, what Im I doing wrong?
- 03 Jul 2016, the Aurelia CLI does not support plugins that contain HTML templates.
- 17 Jul, it was supposed to work with version 0.16.1; we're using 0.18.0, and it doesn't work.
- 28 Jul, to dynamically require text requires setting
stub:false
in thetext
plugin ataurelia.json > build.loader.plugins
.