From 865969f8c4a6e0e80c28f0b868546139043f256d Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Fri, 24 Sep 2021 23:18:57 +0200 Subject: [PATCH] Slightly improve webpack config/plugin --- webpack.config.js | 2 +- webpack.plugin.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index bc885d0..c7e1c97 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -66,7 +66,7 @@ const config = { externals: { vscode: 'commonjs vscode', request: 'commonjs request', - 'source-map-support/register': 'commonjs source-map-support/register', + 'source-map-support': 'commonjs source-map-support', }, resolve: { extensions: ['.ts', '.js'] diff --git a/webpack.plugin.js b/webpack.plugin.js index d746ce1..a7c71e3 100644 --- a/webpack.plugin.js +++ b/webpack.plugin.js @@ -61,10 +61,13 @@ class WebpackPlugin { /** @param {webpack.Compiler} compiler */ apply(compiler) { // Output start/stop messages making the $ts-webpack-watch problemMatcher (provided by an extension) work - compiler.hooks.beforeCompile.tap('WebpackPlugin-BeforeCompile', () => { + let compilationDepth = 0; // We ignore nested compilations + compiler.hooks.beforeCompile.tap('WebpackPlugin-BeforeCompile', (params) => { + if (compilationDepth++) return; console.log('Compilation starting'); }); compiler.hooks.afterCompile.tap('WebpackPlugin-AfterCompile', () => { + if (--compilationDepth) return; console.log('Compilation finished'); }); compiler.hooks.compilation.tap('WebpackPlugin-Compilation', compilation => {