From 2bcf474b6920cac93574f75fce36bfc78e3a5aff Mon Sep 17 00:00:00 2001 From: Kedar Date: Mon, 17 May 2021 06:37:03 -0700 Subject: [PATCH] check this.compiler.outputFileSystem.constructor is not undefined (#447) * check this.compiler.outputFileSystem.constructor is not undefined * Fix trailing spaces lint * Update changelog with bug fix Co-authored-by: Vesa Laakso <482561+valscion@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ src/BundleAnalyzerPlugin.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e40f4e6..a8e0d392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ ## UNRELEASED + * **Bug Fix** + * Fix failure with `compiler.outputFileSystem.constructor` being `undefined` ([#447](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/447) by [@kedarv](https://github.com/kedarv) and [@alexander-akait](https://github.com/alexander-akait)) + * **NOTE:** This fix doesn't have added test coverage so the fix might break in future versions unless test coverage is added later. + ## 4.4.1 * **Bug Fix** diff --git a/src/BundleAnalyzerPlugin.js b/src/BundleAnalyzerPlugin.js index bc37f1de..9e5c2842 100644 --- a/src/BundleAnalyzerPlugin.js +++ b/src/BundleAnalyzerPlugin.js @@ -134,6 +134,9 @@ class BundleAnalyzerPlugin { } getBundleDirFromCompiler() { + if (typeof this.compiler.outputFileSystem.constructor === 'undefined') { + return this.compiler.outputPath; + } switch (this.compiler.outputFileSystem.constructor.name) { case 'MemoryFileSystem': return null;