Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Releases: chrisvfritz/prerender-spa-plugin

v3.4.0

01 Sep 22:50
Compare
Choose a tag to compare

Additions

  • #243 Allow postProcess to return a Promise, allowing for async processing of route output. (See README.md) (Thanks @isidrok!)

Fixes

  • #235 Wait for writeFile to finish instead of treating it like a synchronous call. (Thanks, @qkdreyer!)

v3.3.0

15 Aug 01:13
Compare
Choose a tag to compare

Additions

  • prerenderer/#16 Allow setting the options passed to puppeteer's page.goto() call using new PuppeteerRenderer({rendererOptions: Object}). See README.md. (Thanks @cbravo!)

Breaking

  • #232 Terminate the build process if prerender-spa-plugin fails to render a page. This is the intended behavior. If you relied on this bug, you'll need to adjust accordingly. (Thanks again @cbravo!)

Changes

  • Updated dependencies.

v3.2.1

01 Jun 13:03
Compare
Choose a tag to compare

Fixes

  • #204 DeprecationWarning: Tapable.plugin is deprecated warning in Webpack 4. (Thanks @qkdreyer!)
  • 3.2.0 Included accidental log statement.

Changes

  • #195 Now uses compiler.outputFileSystem to write files instead of fs and mkdirp-promise. Should work exactly the same way in 99.9% of use-cases, and fix an issue in the last 0.1%
  • Updated dependencies.

v3.1.0

25 Apr 11:30
Compare
Choose a tag to compare

Fixes

  • #184 Upgrade prerenderer to 0.7.1 to fix handling of Unicode and non-URL characters in route paths.
  • If users forget to return the context object in postProcess, a clearer error is thrown.

Additions

  • postProcess now allows you to overwrite context.outputPath. It is null by default but will be used if set. Otherwise, it will continue to calculate the output path as normal. Can be used to write files that end with a file extension directly instead of writing them to index.html in a folder by the same name. (#179) See README.

v3.0.0

22 Mar 23:58
Compare
Choose a tag to compare

Upgrade Rationale

prerender-spa-plugin 2.x was developed around PhantomJS and closely integrated with it to provide prerendering support. Unfortunately, PhantomJS has been falling behind in terms of support for modern web platform features, often requiring unwieldy polyfills. In the meantime, alternatives such as puppeteer have filled the void left by PhantomJS.

However, it was impossible for us to maintain full backwards-compatibility with prerender-spa-plugin 2.x while also switching out the rendering backend, so instead we took this as an opportunity to modularize the plugin and make a few much-needed changes while also replacing PhantomJS with puppeteer.

For clarification, basic usage of prerender-spa-plugin 3 is still backwards-compatible with 2.x, but deprecated. For obvious reasons, custom configuration of PhantomJS will no longer function.

Notable Changes

  • The plugin initialization signature has changed from new PrerenderSPAPlugin(staticDir: String, routes: Array<String>, config: Object) to new PrerenderSPAPlugin(config: Object). For example: new PrerenderSPAPlugin({ staticDir: String, routes: String, })
  • Minification support has been added using html-minifier. Anything under the minify configuration property will be passed to html-minifier.
  • You can now pass any JSON-stringifiable object to a renderer’s inject property and it will be added to window['__PRERENDER_INJECTED'] when the pages are rendered. (The window destination property can be configured with injectProperty: String)
  • We now support two render backends: Puppeteer and JSDOM.
  • Puppeteer is the most accurate of the two, rendering in a bundled Chromium browser, but JSDOM is much faster and can render thousands of routes without a hitch by emulating a browser inside Node.js.
    Puppeteer comes bundled with the plugin under PrerenderSPAPlugin.PuppeteerRenderer. You’ll have to install the JSDOM renderer yourself using npm install @prerenderer/renderer-jsdom. and require('@prerenderer/renderer-jsdom').
  • It is now possible to implement your own render backend. We don’t have any documentation on this at the moment, but you can take a look at the source for the two supported renderers.
  • Renderers must now be initialized in the plugin configuration if you wish to configure them. Several of the options previously in the root configuration have moved to the renderer configuration. Example:
    new PrerenderSPAPlugin({
      staticDir: path.join(__dirname, 'dist'),
      routes: ['/', '/about', '/config'],
    
      // This allows other renderers to be implemented with a
      // subset or superset of features.
      renderer: new PrerenderSPAPlugin.PuppeteerRenderer({  
        inject: {foo: 'bar'},
        renderAfterDocumentEvent: 'render-event',
        headless: false
      })
    })
    

Breaking Changes & Deprecactions

DEPRECATION: captureAfter* configuration values have moved to the renderer configuration and renamed to renderAfter* for consistency. You can still use captureAfter* but you will recieve a deprecation warning.
DEPRECATION: Attempting to use the old style plugin initialization new PrerenderSPAPlugin(staticDir: String, routes: Array<String>, config: Object) will result in a deprecation warning.
DEPRECATION: postProcessHtml has been replaced with postProcess which allows processing HTML as well as adjusting the output routes. Using postProcessHtml should still function, but result in a deprecation warning.
BREAKING: captureAfter* / renderAfter* options can no longer be mixed, as this could sometimes result in confusing behavior or race conditions. Pick one and stick with it.
BREAKING: Renderers must be configured in their own initializers, separately from the plugin. (See the example above.)
BREAKING: PhantomJS options are no longer supported. You can, however pass launch options to the configuration for the Puppeteer renderer. The full list of options is available here.

v2.1.0

01 Aug 00:39
f76cb4a
Compare
Choose a tag to compare

New features

  • Updated phantomjs-prebuilt dependency to 2.1.8; was 2.1.7. (#83)
  • PhantomJS now will serve hidden directories. (#75)
  • Add option outputDir to allow custom output directory of static HTML. (#38)
  • Add option indexPath to allow customization of default index.html path. (#81)
  • Add option phantomPageViewportSize to adjust default PhantomJS viewport dimensions. (#73)

Fixed bugs

  • Path to resolve core-js is more reliable. (#54)

v2.0.0

24 Dec 05:07
Compare
Choose a tag to compare

Breaking changes

  • JS errors now throw an error in the build rather than printing the errors to prerendered files
  • doctype is no longer stripped during prerendering (really a bug, but technically also a breaking change) (fixes #20)

New features

  • ES2015+ language features are now available during prerendering via core.js (fixes #5)
  • since JS errors now throw a fatal error, an ignoreJSErrors option is available to quietly swallow errors
  • a new postProcessHTML option is available for edge cases to (fixes #19)

Fixed bugs

  • capture page errors instead of printing them to the page, then add an ignoreJSErrors option
  • plugin now correctly reports when it's done
  • fixed failure on large files (#14)
  • doctype is no longer stripped during prerendering (fixes #20)