Skip to content

Commit 4df33e9

Browse files
committed
fix: Avoid auto-reload for recently created source directory
Watchpack has a bug that caused it to dispatch change events for files that were created recently (up to 2 seconds before now). This can trigger an unwanted auto-reload, e.g. in the scenario of an extension developer building an extension and using `web-ext run` to immediately launch that built package. Fixing this bug caused test.cli.run-target-chromium.js to time out because the "with auto-reload" test got stuck, because it waited until "The extension will reload if any source file changes" was logged before writing a file to trigger auto-reload, but that message was logged before the watcher was registered. To fix that test issue, move the logging after initializing the reload strategy.
1 parent 35a9e30 commit 4df33e9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/cmd/run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ export default async function run(
206206
if (noReload) {
207207
log.info('Automatic extension reloading has been disabled');
208208
} else {
209-
log.info('The extension will reload if any source file changes');
210-
211209
reloadStrategy({
212210
extensionRunner,
213211
sourceDir,
@@ -217,6 +215,8 @@ export default async function run(
217215
ignoreFiles,
218216
noInput,
219217
});
218+
219+
log.info('The extension will reload if any source file changes');
220220
}
221221

222222
return extensionRunner;

0 commit comments

Comments
 (0)