Skip to content

Commit

Permalink
Merge pull request jupyterlab#7768 from telamonian/no-dup-check-in-watch
Browse files Browse the repository at this point in the history
watch mode: reduces noise in console output by disabling pkg duplicate checker
  • Loading branch information
Steven Silvester committed Jan 10, 2020
2 parents 95671a0 + f81f990 commit 9487a22
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions buildutils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"commander": "~4.0.1",
"crypto": "~1.0.1",
"dependency-graph": "^0.8.1",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"fs-extra": "^8.1.0",
"glob": "~7.1.6",
"inquirer": "^7.0.0",
Expand All @@ -57,6 +58,7 @@
"webpack": "^4.41.2"
},
"devDependencies": {
"@types/duplicate-package-checker-webpack-plugin": "^2.1.0",
"@types/fs-extra": "^8.0.1",
"@types/glob": "^7.1.1",
"@types/inquirer": "^6.5.0",
Expand Down
19 changes: 18 additions & 1 deletion buildutils/src/webpack-plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

import * as webpack from 'webpack';
import DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
import * as fs from 'fs-extra';
import * as webpack from 'webpack';

export namespace WPPlugin {
/**
Expand Down Expand Up @@ -171,4 +172,20 @@ export namespace WPPlugin {

ignored: (path: string) => boolean;
}

export class NowatchDuplicatePackageCheckerPlugin extends DuplicatePackageCheckerPlugin {
apply(compiler: any) {
const options = this.options;

compiler.hooks.run.tap(
'NowatchDuplicatePackageCheckerPlugin',
(compiler: any) => {
const p = new DuplicatePackageCheckerPlugin(options);
p.apply(compiler);
}
);
}

options: DuplicatePackageCheckerPlugin.Options;
}
}
9 changes: 2 additions & 7 deletions dev_mode/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var fs = require('fs-extra');
var Handlebars = require('handlebars');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
var DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;

Expand Down Expand Up @@ -122,7 +121,7 @@ function ignored(path) {
}

const plugins = [
new DuplicatePackageCheckerPlugin({
new WPPlugin.NowatchDuplicatePackageCheckerPlugin({
verbose: true,
exclude(instance) {
// ignore known duplicates
Expand All @@ -137,7 +136,6 @@ const plugins = [
title: jlab.name || 'JupyterLab'
}),
new webpack.HashedModuleIdsPlugin(),

// custom plugin for ignoring files during a `--watch` build
new WPPlugin.FilterWatchIgnorePlugin(ignored),
// custom plugin that copies the assets to the static directory
Expand Down Expand Up @@ -223,9 +221,6 @@ module.exports = [
bail: true,
devtool: 'inline-source-map',
externals: ['node-fetch', 'ws'],
plugins,
stats: {
chunkModules: true
}
plugins
}
].concat(extraConfig);
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,13 @@
dependencies:
"@types/domhandler" "*"

"@types/duplicate-package-checker-webpack-plugin@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@types/duplicate-package-checker-webpack-plugin/-/duplicate-package-checker-webpack-plugin-2.1.0.tgz#02f030a6432274b16529e434d5ea696024f363b2"
integrity sha512-lS1AUw32mjdqhObsY2lxzo5qWeFnMZmhAVmh+rHbXdsxIE8cFMIA37NtIDXxkLhFLvF1ua/C5rcMsGumhpGFuA==
dependencies:
"@types/webpack" "*"

"@types/estree@*":
version "0.0.41"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.41.tgz#fd90754150b57432b72bf560530500597ff04421"
Expand Down

0 comments on commit 9487a22

Please sign in to comment.