@umijs/plugin-prerender
TypeScript icon, indicating that this package has built-in type declarations

1.8.4 • Public • Published

@umijs/plugin-prerender

NPM version NPM downloads

A plugin for Umijs Pre Render.

Usage

Configure in .umirc.js,

export default {
  plugins: [['@umijs/plugin-prerender', options]],
};

Options

extends IConfig.

export interface IOpts extends IConfig {
  include?: string[];
  exclude?: string[];
  /** extra routes, for dynamic routes */
  extra?: string[];
  /** disable ssr BOM polyfill */
  disablePolyfill?: boolean;
  // htmlSuffix
  htmlSuffix?: boolean;
  runInMockContext?: object | (() => object);
}
  • include: include routes to pre render
  • exclude: exclude routes not pre render
  • disablePolyfill: disable ssr-polyfill for client window object
  • runInMockContext: you mock global
  • staticMarkup: use renderToStaticMarkup, default use renderToString
  • htmlSuffix: route Enable the .html suffix.

TODO

  • [x] support dynamicImport for chunkMap assets, render chunk styles and prefetch scripts.
  • [x] friendly log shows like ▶ start, ☒ complete, ✔ success
  • [x] Check server-side render content hash code, whether help re-render if client not sync with server.
  • [x] runInMockContext for users can custom your global variables.
  • [x] use jsdom for mock Bom in Node env.
  • [x] support react-document-title, react-helmet to dynamic title.
  • [ ] dynamic route prerender
  • [ ] more test cases, add coverage badge
  • [ ] register command umi render-preview to run a static server for prerendered site.

LICENSE

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @umijs/plugin-prerender

Weekly Downloads

34

Version

1.8.4

License

MIT

Unpacked Size

21.7 kB

Total Files

8

Last publish

Collaborators

  • xusd320
  • yifankakaxi
  • xierenyuan
  • stormslowly
  • xiefengnian
  • sorrycc
  • chenshuai2144
  • kuitos
  • peachscript
  • xiaohuoni