aurelia-contrib / aurelia-open-id-connect

An aurelia adapter for the IdentityModel/oidc-client-js
https://zamboni-app.azurewebsites.net
MIT License
54 stars 18 forks source link

Usage with webpack #7

Closed mttmccb closed 7 years ago

mttmccb commented 7 years ago

I'm running into an an issue with webpack, it doesn't look like it's importing the HTML template too as it can't find open-id-connect-user-block, any ideas how to adjust the config?

mttmccb commented 7 years ago

I've tried a few of the options in aurelia-webpack-plugin but no joy so far.

shaunluttin commented 7 years ago

@mttmccb I'm afraid I do not have any experience using WebPack. I do recall experiencing some frustration myself with having the HTML templates work. As a way to isolate the issue, does the demo project work for you?

git clone https://github.com/shaunluttin/aurelia-open-id-connect.git
cd aurelia-open-id-connect/demo
npm install -y
npm run demo
shaunluttin commented 7 years ago

@mttmccb I just read my own README and it answers your question. :smile:

Set build.loader.plugs.stub = false in aurelia.json to load HTML from the package.

"loader": {
  "type": "require",
  "configTarget": "vendor-bundle.js",
  "includeBundleMetadataInConfig": "auto",
  "plugins": [
    {
      "name": "text",
      "extensions": [
        ".html",
        ".css"
      ],
      "stub":false               <----------- Set this to false.
    }
  ]
},
mttmccb commented 7 years ago

Can't get past that step, I'm getting a script error in main.js, I can't see any obvious erorrs though...

Once this issue has been resolved I'll try webpack again, hopefully early next week.

mttmccb commented 7 years ago

For the webpack project there is no aurelia.json, I suspect the changes I'm making aren't working as I don't know how to change easy-webpack to do what I want it to.

shaunluttin commented 7 years ago

@mttmccb Thank you for the update. It would be great to have this plugin working with all the major package managers that Aurelia supports. I appreciate your support.

mttmccb commented 7 years ago

After switching to a more standard webpack setup I was able to include the missing resources by adding this into my packages.json

  "aurelia": {
    "build": {
      "resources": [
        "aurelia-notification",
        "aurelia-i18n",
        "aurelia-animator-css",
        "aurelia-open-id-connect",
        "aurelia-open-id-connect/open-id-connect-user-block",
        "aurelia-open-id-connect/open-id-connect-role-filter"
      ]
    }
  },
shaunluttin commented 7 years ago

@mttmccb Thank you for the update. I appreciate that. That will help me to support WebPack with this plugin. I will close this issue. Thank you for your contribution, and please add other issues if you have any questions about using the plugin.