Slightly improve webpack config/plugin

issue/311
Kelvin Schoofs 3 years ago
parent 1f7e333b15
commit 865969f8c4

@ -66,7 +66,7 @@ const config = {
externals: { externals: {
vscode: 'commonjs vscode', vscode: 'commonjs vscode',
request: 'commonjs request', request: 'commonjs request',
'source-map-support/register': 'commonjs source-map-support/register', 'source-map-support': 'commonjs source-map-support',
}, },
resolve: { resolve: {
extensions: ['.ts', '.js'] extensions: ['.ts', '.js']

@ -61,10 +61,13 @@ class WebpackPlugin {
/** @param {webpack.Compiler} compiler */ /** @param {webpack.Compiler} compiler */
apply(compiler) { apply(compiler) {
// Output start/stop messages making the $ts-webpack-watch problemMatcher (provided by an extension) work // 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'); console.log('Compilation starting');
}); });
compiler.hooks.afterCompile.tap('WebpackPlugin-AfterCompile', () => { compiler.hooks.afterCompile.tap('WebpackPlugin-AfterCompile', () => {
if (--compilationDepth) return;
console.log('Compilation finished'); console.log('Compilation finished');
}); });
compiler.hooks.compilation.tap('WebpackPlugin-Compilation', compilation => { compiler.hooks.compilation.tap('WebpackPlugin-Compilation', compilation => {

Loading…
Cancel
Save