From a9e6f5dfda56062d285588b5f2812517482e6a8e Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Thu, 24 Jan 2019 13:25:15 +0200 Subject: [PATCH] fix: lazy-ngmodule-hot-loader breaks the sourceMaps The `lazy-ngmodule-hot-loader` breaks sourceMaps as it does not pass them to the next loaders. This breaks debugging with `--bundle` in VSCode extension as the files included in the `sourcesContent` cannot be mapped correctly to local files. --- lazy-ngmodule-hot-loader.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lazy-ngmodule-hot-loader.js b/lazy-ngmodule-hot-loader.js index 054602a3..d38f20b8 100644 --- a/lazy-ngmodule-hot-loader.js +++ b/lazy-ngmodule-hot-loader.js @@ -21,8 +21,10 @@ const isLazyLoadedNgModule = resource => { return issuerContext && issuerContext.endsWith(LAZY_RESOURCE_CONTEXT); }; -module.exports = function (source) { - return isLazyLoadedNgModule(this._module) ? - `${source};${HMR_HANDLER}` : +module.exports = function (source, map) { + const modifiedSource = isLazyLoadedNgModule(this._module) ? + `${source};${HMR_HANDLER}`: source; + + this.callback(null, modifiedSource, map); };