easy-team/easywebpack

How can add additional scripts in Render function

Penggggg opened this issue · 2 comments

How can i add additional scripts in easywebpack-vue-ssr Render function

I want to add an additional Js ( vconsole.js ) just for some specified users. So i want to add some string in ssr renderString. Is there an option just like vue-ssr renderToString function in easy-webpack-vue render function ? Thx.

add additional scripts in vue-ssr

   const renderer = vueSSR.createBundleRenderer(// ...);
   const html = await renderer.renderToString({
       links: `
           <script src="/dist/vconsole.min.js"></script>
           <script>
              var vConsole = new VConsole( );
            </script>
       `
    })

easy-webpack-vue-ssr

  async index() {
    await this.ctx.render('app/app.js', {
      url: this.ctx.url.replace(/\/app/, '')
      //  how can i add my additioanl scripts here
    });
  }

你可以直接在页面里面 script 引入 VConsole