Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] Silent-renew - how about entry in quasar.config.js? #3

Open
Arsync opened this issue Aug 30, 2019 · 3 comments
Open

[Improvement] Silent-renew - how about entry in quasar.config.js? #3

Arsync opened this issue Aug 30, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@Arsync
Copy link

Arsync commented Aug 30, 2019

// quasar.config.js
const
  path = require('path'),
  HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = function (ctx) {
  ...
  build: {
    ...
    chainWebpack(chain, { isClient }) {    
      if (isClient) {      

        chain.entry('sign-in-silent')
          .add('src/sign-in-slient.ts')
          .end();

        // Important! Need to exclude this entry from main 'index.html', where chunks: 'all'     
        // Not working as expected- there is no 'html-webpack' at run,
        // but exists at 'quasar inspect'
        //
        //chain.plugin('html-webpack')
        //  .tap(args => {
        //    args[0].excludeChunks = ['sign-in-silent'];
        //    return args;
        //  });
      
        chain.plugin('html-silent')
          .use(new HtmlWebpackPlugin({
            template: path.resolve('src/sign-in-silent.html'),
            filename: 'sign-in-silent/index.html',
            chunks: ['sign-in-silent']
          }));
      }
    }
  }
}

Entry point for our silent callback:

// src/sign-in-silent.js
import { UserManager } from 'oidc-client';
new UserManager().signinSilentCallback();

Template:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>Silent Sign-In</title>
</head>
<body>
</body>
</html>

No need to put anything into template, entry will be added by HtmlWebpackPlugin.

@patrickmonteiro
Copy link
Owner

@Arsync Hello, this seems to be a really great improvement. The first version I made of quasar oidc-client was made in a hurry because of the need for a project.
I plan to redo a version now in quasar 1.0 as well.

Soon I will try to update this project with its improvement.

@patrickmonteiro patrickmonteiro added the enhancement New feature or request label Aug 30, 2019
@Arsync
Copy link
Author

Arsync commented Aug 30, 2019

But be careful, where am I stuck on this: quasarframework/quasar#4999
Can't exclude 'silent-sign-in' from default entry... So it includes it in index.html too.

@patrickmonteiro
Copy link
Owner

In fact, I will still refactor the whole project.
It really was something quite complex to implement at the time, as there is little documentation.
Today with a little more knowledge I believe I can optimize many things.

But the silent renovation so far has not worked so well for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants