From b10b93faa37532fc173d71563f69489135e850fc 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lazy-ngmodule-hot-loader.js b/lazy-ngmodule-hot-loader.js index 1f168c6a..828afc98 100644 --- a/lazy-ngmodule-hot-loader.js +++ b/lazy-ngmodule-hot-loader.js @@ -10,8 +10,10 @@ const isLazyLoadedNgModule = resource => { return issuerContext && issuerContext.endsWith(LAZY_RESOURCE_CONTEXT); }; -module.exports = function (source) { - return isLazyLoadedNgModule(this._module) ? +module.exports = function (source, map) { + const modifiedSource = isLazyLoadedNgModule(this._module) ? `${source};${HOT_SELF_ACCEPT}`: source; + + this.callback(null, modifiedSource, map); };