In SpaServices NuGet package, pass through error stack when NPM modules fail to load

This commit is contained in:
SteveSandersonMS
2016-09-21 11:11:24 +01:00
parent 232e908ce8
commit f9807c546d
2 changed files with 8 additions and 2 deletions

View File

@@ -4,7 +4,10 @@ module.exports.renderToString = function (callback) {
try { try {
aspNetPrerendering = require('aspnet-prerendering'); aspNetPrerendering = require('aspnet-prerendering');
} catch (ex) { } catch (ex) {
callback('To use prerendering, you must install the \'aspnet-prerendering\' NPM package.'); // Developers sometimes have trouble with badly-configured Node installations, where it's unable
// to find node_modules. Or they accidentally fail to deploy node_modules, or even to run 'npm install'.
// Make sure such errors are reported back to the .NET part of the app.
callback('Prerendering failed because of an error while loading \'aspnet-prerendering\'. Error was: ' + ex.stack);
return; return;
} }

View File

@@ -4,7 +4,10 @@ module.exports.createWebpackDevServer = function (callback) {
try { try {
aspNetWebpack = require('aspnet-webpack'); aspNetWebpack = require('aspnet-webpack');
} catch (ex) { } catch (ex) {
callback('To use webpack dev middleware, you must install the \'aspnet-webpack\' NPM package.'); // Developers sometimes have trouble with badly-configured Node installations, where it's unable
// to find node_modules. Or they accidentally fail to deploy node_modules, or even to run 'npm install'.
// Make sure such errors are reported back to the .NET part of the app.
callback('Webpack dev middleware failed because of an error while loading \'aspnet-webpack\'. Error was: ' + ex.stack);
return; return;
} }