Skip to content

Commit

Permalink
Slightly improve webpack config/plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
SchoofsKelvin committed Oct 2, 2021
1 parent 1f7e333 commit 865969f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
5 changes: 4 additions & 1 deletion webpack.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 865969f

Please sign in to comment.