[v9.2.x] Toolkit: Fix compilation loop when watching plugins for changes (#58695)

Toolkit: Fix compilation loop when watching plugins for changes (#58167)

* fix(toolkit): ignore node_modules and dist directories when watching for changes to plugin

* fix(toolkit): move watchOptions.ignored config to pluginDev watch call

(cherry picked from commit ce50400740)

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2022-11-14 09:54:58 +01:00
committed by GitHub
co-authored by Jack Westbrook
parent 0f0211f400
commit d074471557
2 changed files with 1 additions and 3 deletions
@@ -22,9 +22,8 @@ export const bundlePlugin = async ({ watch, production, preserveConsole }: Plugi
const webpackPromise = new Promise<void>((resolve, reject) => {
if (watch) {
console.log('Started watching plugin for changes...');
compiler.watch({}, (err, stats) => {});
compiler.watch({ ignored: ['**/node_modules', '**/dist'] }, (err, stats) => {});
// @ts-ignore
compiler.hooks.invalid.tap('invalid', () => {
clearConsole();
console.log('Compiling...');
@@ -162,7 +162,6 @@ const getBaseWebpackConfig: WebpackConfigurationGetter = async (options) => {
libraryTarget: 'amd',
publicPath: '/',
},
performance: { hints: false },
externals: [
'lodash',