Socket
Socket
Sign inDemoInstall

puppeteer-html-prerender-webpack-plugin

Package Overview
Dependencies
257
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    puppeteer-html-prerender-webpack-plugin

puppeteer html prerender webpack plugin


Version published
Weekly downloads
9
increased by80%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

puppeteer-html-prerender-webpack-plugin

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Implement server pre-rendering by Puppeteer, including obtaining the HTML structure content rendered, support server side render(ssr) and client side render(csr) page.

Install

npm install puppeteer-html-prerender-webpack-plugin --save-dev

Usage

const PuppeteerHtmlPrerenderPlugin = require('puppeteer-html-prerender-webpack-plugin');
module.exports = {
  plugins:[
    new PuppeteerHtmlPrerenderPlugin({
      url: 'http://49.233.172.37:7001/csr',
      selector: '#app',
      waitSelector: '#app',
      beforeEvaluate: async (browser, page) => {
        await page.setUserAgent('Mozilla/5.0 (Linux; U; Android 9; en-US) Chrome/57.0.2987.108 UCBrowser/12.12.5.1189 Mobile');
      },
      afterEvaluate: async (browser, page, html) => {
        return html;
      },
    })
  ]
}

Configuration

PuppeteerHtmlPrerenderPlugin options:

  • url - prefetch render url
  • selector { optional } - fetch selector element html. if not exist, will return all html.
  • selectorOuterHTML { optional, default: true } - return selector self node content.
  • waitSelector { optional } - fetch selector element html until waiting selector element exist, the config can get the client render mode html content.
  • debug { optional, default: false } - print puppeteer execute cost and key info
  • beforeEvaluate { optional } - before evaluate fetch hook
  • afterEvaluate { optional } - after evaluate fetch hook

License

MIT

Keywords

FAQs

Last updated on 06 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc