diff --git a/package.json b/package.json index 2aa0c7af2..d7c5d1851 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@types/micromatch": "^3.1.0", "@types/node": "*", "@types/semver": "^6.0.0", - "@types/webpack": "^4.4.30", + "@types/webpack": "~4.41.0", "babel": "^6.0.0", "babel-core": "^6.0.0", "babel-loader": "^7.0.0", @@ -93,7 +93,7 @@ "tslint": "^5.11.0", "tslint-config-prettier": "^1.15.0", "typescript": "^3.6.2", - "webpack": "^4.5.0", + "webpack": "^4.41.4", "webpack-cli": "^3.1.1" }, "peerDependencies": { diff --git a/src/after-compile.ts b/src/after-compile.ts index 517eb6f64..55e80eb79 100644 --- a/src/after-compile.ts +++ b/src/after-compile.ts @@ -39,7 +39,8 @@ export function makeAfterCompile( return; } - removeTSLoaderErrors(compilation.errors); + // @ts-ignore + removeTSLoaderErrors(compilation.getErrors && compilation.getErrors() || compilation.errors); provideCompilerOptionDiagnosticErrorsToWebpack( getCompilerOptionDiagnostics, @@ -114,8 +115,9 @@ function provideCompilerOptionDiagnosticErrorsToWebpack( * based on filepath */ function determineModules(compilation: webpack.compilation.Compilation) { - return compilation.modules.reduce>( - (modules, module) => { + const modules = new Map(); + compilation.modules.forEach( + (module) => { if (module.resource) { const modulePath = path.normalize(module.resource); const existingModules = modules.get(modulePath); @@ -127,11 +129,9 @@ function determineModules(compilation: webpack.compilation.Compilation) { modules.set(modulePath, [module]); } } - - return modules; - }, - new Map() + } ); + return modules; } function determineFilesToCheckForErrors( @@ -229,7 +229,8 @@ function provideErrorsToWebpack( if (associatedModules !== undefined) { associatedModules.forEach(module => { // remove any existing errors - removeTSLoaderErrors(module.errors); + // @ts-ignore + removeTSLoaderErrors(module.getErrors && module.getErrors() || module.errors); // append errors const formattedErrors = formatErrors( @@ -287,7 +288,8 @@ function provideSolutionErrorsToWebpack( if (associatedModules !== undefined) { associatedModules.forEach(module => { // remove any existing errors - removeTSLoaderErrors(module.errors); + // @ts-ignore + removeTSLoaderErrors(module.getErrors && module.getErrors() || module.errors); // append errors const formattedErrors = formatErrors(