fix: file reloading mechanism and add profile watch ignores#2112
fix: file reloading mechanism and add profile watch ignores#2112ZerGo0 wants to merge 3 commits intowxt-dev:mainfrom
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
aklinker1
left a comment
There was a problem hiding this comment.
Nice, I really like these changes!
I just woke up and am on mobile, so I'll need to do some manual testing to make sure everything is working later today.
@wxt-dev/analytics
@wxt-dev/auto-icons
@wxt-dev/browser
@wxt-dev/i18n
@wxt-dev/module-react
@wxt-dev/module-solid
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/runner
@wxt-dev/storage
@wxt-dev/unocss
@wxt-dev/webextension-polyfill
wxt
commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2112 +/- ##
==========================================
+ Coverage 76.03% 76.58% +0.54%
==========================================
Files 113 114 +1
Lines 3034 3079 +45
Branches 680 691 +11
==========================================
+ Hits 2307 2358 +51
+ Misses 643 638 -5
+ Partials 84 83 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I pushed another small change. I don't really like the changes in 0cf79bb but I can't really think of a better way of doing this. The problem is that it would show potentially wrong files in the "Changed: ..." log line and so on because they all use the "raw"/unfiltered queue. My latest commit fixes that. |
|
I'm also have 1 file on which HMR doesn't work and i was about to report it, but i'll check it on your branch, maybe your PR will solve that issue 😄 |
aklinker1
left a comment
There was a problem hiding this comment.
Tested, things seem to behave the same way for me. One requested change.
| * changes. | ||
| */ | ||
| function createFileReloader(server: WxtDevServer) { | ||
| export function createFileReloader(server: WxtDevServer) { |
There was a problem hiding this comment.
Exporting this here will export the function from the main wxt module as a public API, but I don't want this to be public. Move to another file, maybe in src/core/utils/create-file-reloader.ts, if you want to export and test it.
wxt/packages/wxt/src/core/index.ts
Line 5 in 50d7c1e
Line 9 in 50d7c1e
There was a problem hiding this comment.
Done, had to move a bit more than just createFileReloader.
- Exported `createFileReloader` function to allow external usage. - Improved the file reloading process by implementing a queue worker to handle multiple file changes without dropping events. - Added `getRunnerProfileWatchIgnores` function to dynamically generate ignored paths based on user profiles for Chromium and Firefox. - Updated Vite builder configuration to include these new ignore patterns.
- Introduced `getRelevantDevChangedFiles` to filter out unrelated file changes. - Updated `detectDevChanges` to utilize the new filtering function for improved accuracy. - Modified `createFileReloader` to work with relevant file changes, ensuring only necessary reloads occur. - Enhanced tests to validate the new behavior and ensure proper handling of HTML-only reloads.
Move createFileReloader into an internal core utils file and update create-server/test imports.
41b2084 to
9e4d40d
Compare
|
it's working for Windows also, but it doesn't solve my issue, i'll open new issue about it. |
| try { | ||
| const { output: newOutput } = await rebuild( | ||
| allEntrypoints, | ||
| // TODO: this excludes new entrypoints, so they're not built until the dev command is restarted |
There was a problem hiding this comment.
Let's fix it or remove if it's outdated
Overview
Fixes flaky dev reload detection where WXT sometimes ignores real source file saves.
Root cause:
leading: true,trailing: false) and queued events inside that callback.Changes:
packages/wxt/src/core/create-server.tsto:packages/wxt/src/core/builders/vite/index.tsso browser profile churn is not watched:chromiumProfilefirefoxProfilechromiumArgs--user-data-dir(split and=forms)firefoxArgs-profile(split and=forms)packages/wxt/src/core/__tests__/create-server.test.tsManual Testing
This is pretty hard/annoying to reproduce. The new test is probably the best way of reproducing this:
pnpm -C packages/wxt test --run src/core/__tests__/create-server.test.tschromiumArgs: ['--user-data-dir=./private/.dev-profile']firefoxProfile: './private/.dev-firefox-profile'pnpm wxt.Related Issue
None I think.