Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer-html-prerender-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-html-prerender-webpack-plugin

puppeteer html prerender webpack plugin

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 06 Jan 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc