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 #235 from qkdreyer/master
Browse files Browse the repository at this point in the history
Fixed empty file written to outputPath
  • Loading branch information
JoshTheDerf authored Aug 17, 2018
2 parents 8abb6ec + d890455 commit a501698
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 4 additions & 5 deletions es5-autogenerated/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ PrerenderSPAPlugin.prototype.apply = function (compiler) {
return mkdirp(path.dirname(processedRoute.outputPath)).then(function () {
return new Promise(function (resolve, reject) {
compilerFS.writeFile(processedRoute.outputPath, processedRoute.html.trim(), function (err) {
if (err) reject(`[prerender-spa-plugin] Unable to write rendered route to file "${processedRoute.outputPath}" \n ${err}.`);
if (err) reject(`[prerender-spa-plugin] Unable to write rendered route to file "${processedRoute.outputPath}" \n ${err}.`);else resolve();
});

resolve();
});
}).catch(function (err) {
if (typeof err === 'string') {
Expand All @@ -153,8 +151,9 @@ PrerenderSPAPlugin.prototype.apply = function (compiler) {
done();
}).catch(function (err) {
PrerendererInstance.destroy();
console.error('[prerender-spa-plugin] Unable to prerender all routes!');
compilation.errors.push(new Error('[prerender-spa-plugin] Unable to prerender all routes!'));
var msg = '[prerender-spa-plugin] Unable to prerender all routes!';
console.error(msg);
compilation.errors.push(new Error(msg));
done();
});
};
Expand Down
10 changes: 5 additions & 5 deletions es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ PrerenderSPAPlugin.prototype.apply = function (compiler) {
return new Promise((resolve, reject) => {
compilerFS.writeFile(processedRoute.outputPath, processedRoute.html.trim(), err => {
if (err) reject(`[prerender-spa-plugin] Unable to write rendered route to file "${processedRoute.outputPath}" \n ${err}.`)
else resolve()
})

resolve()
})
})
.catch(err => {
Expand All @@ -143,9 +142,10 @@ PrerenderSPAPlugin.prototype.apply = function (compiler) {
})
.catch(err => {
PrerendererInstance.destroy()
console.error('[prerender-spa-plugin] Unable to prerender all routes!');
compilation.errors.push( new Error( '[prerender-spa-plugin] Unable to prerender all routes!' ) );
done();
const msg = '[prerender-spa-plugin] Unable to prerender all routes!'
console.error(msg)
compilation.errors.push(new Error(msg))
done()
})
}

Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"name": "Joshua Bemenderfer",
"email": "[email protected]",
"url": "https://joshderf.com/"
},
{
"name": "qkdreyer",
"email": "[email protected]"
}
],
"repository": "chrisvfritz/prerender-spa-plugin",
Expand Down

0 comments on commit a501698

Please sign in to comment.