mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 10:08:57 +00:00
Better reporting of Webpack compilation errors to fix #159
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "aspnet-webpack",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Helpers for using Webpack in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -80,6 +80,11 @@ function loadViaWebpackNoCache<T>(webpackConfigPath: string, modulePath: string)
|
||||
} else {
|
||||
// We're in a callback, so need an explicit try/catch to propagate any errors up the promise chain
|
||||
try {
|
||||
if (stats.hasErrors()) {
|
||||
throw new Error('Webpack compilation reported errors. Compiler output follows: '
|
||||
+ stats.toString({ chunks: false }));
|
||||
}
|
||||
|
||||
const fileContent = compiler.outputFileSystem.readFileSync('/webpack-output.js', 'utf8');
|
||||
const moduleInstance = requireFromString<T>(fileContent);
|
||||
resolve(moduleInstance);
|
||||
|
||||
Reference in New Issue
Block a user