From ba21ffd790c3bcf9c4a6c7abf58cb9b534eb5de8 Mon Sep 17 00:00:00 2001 From: unclebill Date: Wed, 14 Jul 2021 23:30:53 +0800 Subject: [PATCH] fix(build): watcher of webpack watches too many files include output files closes #3672 --- packages/maskbook/webpack.config.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/maskbook/webpack.config.ts b/packages/maskbook/webpack.config.ts index b95c690c84cd..ad86eaf0ae7e 100644 --- a/packages/maskbook/webpack.config.ts +++ b/packages/maskbook/webpack.config.ts @@ -48,6 +48,9 @@ function EnvironmentPluginNoCache(def: Record) { } return new DefinePlugin(next) } +const watchOptions = { + ignored: /\bnode_modules\b/, +} function config(opts: { name: string @@ -232,6 +235,7 @@ function config(opts: { 'Access-Control-Allow-Origin': '*', }, transportMode: 'ws', + watchOptions, } as DevServerConfiguration, } if (isProfile) { @@ -323,7 +327,7 @@ export default async function (cli_env: Record = {}, argv: { mo // @ts-ignore delete injectedScript.devServer // TODO: multiple config seems doesn't work well therefore we start the watch mode webpack compiler manually, ignore the build message currently - webpack(injectedScript, () => {}).watch({}, () => {}) + webpack(injectedScript).watch(watchOptions, () => {}) return main function withReactDevTools(...x: string[]) {