Skip to content

Commit f9807c5

Browse files
In SpaServices NuGet package, pass through error stack when NPM modules fail to load
1 parent 232e908 commit f9807c5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

‎src/Microsoft.AspNetCore.SpaServices/Content/Node/prerenderer.js‎

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

‎src/Microsoft.AspNetCore.SpaServices/Content/Node/webpack-dev-middleware.js‎

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

0 commit comments

Comments
(0)