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

Commit

Permalink
Merge pull request #205 from qkdreyer/patch-1
Browse files Browse the repository at this point in the history
Fixed #204
  • Loading branch information
JoshTheDerf authored Jun 1, 2018
2 parents 3bc77eb + 19698ab commit cbdc72a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function PrerenderSPAPlugin (...args) {
}

PrerenderSPAPlugin.prototype.apply = function (compiler) {
compiler.plugin('after-emit', (compilation, done) => {
const afterEmit = (compilation, done) => {
const PrerendererInstance = new Prerenderer(this._options)

PrerendererInstance.initialize()
Expand Down Expand Up @@ -139,7 +139,14 @@ PrerenderSPAPlugin.prototype.apply = function (compiler) {
console.error('[prerender-spa-plugin] Unable to prerender all routes!')
throw err
})
})
}

if (compiler.hooks) {
const plugin = { name: 'PrerenderSPAPlugin' }
compiler.hooks.afterEmit.tapAsync(plugin, afterEmit)
} else {
compiler.plugin('after-emit', afterEmit)
}
}

PrerenderSPAPlugin.PuppeteerRenderer = PuppeteerRenderer
Expand Down

0 comments on commit cbdc72a

Please # to comment.