New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content Script UI can't reload #538
Comments
Hmm, seems related to the other report of the Vue plugin behaving weird. I'll try and debug this more soon... |
I encountered the same problem. |
I'm having this problem too. |
@wuzequanyouzi I tested it, no problem, thanks. In import { defineConfig } from 'wxt';
import vue from '@vitejs/plugin-vue';
// See https://wxt.dev/api/config.html
export default defineConfig({
imports: {
presets: ['vue'],
addons: {
vueTemplate: true,
},
},
vite: () => ({
plugins: [vue()],
// Add here 👏👏👏
build: {
sourcemap: false
}
}),
} |
Good find @wuzequanyouzi! Vue seems to be the only plug-in with this problem, I need to explore their source code to see why it breaks |
@aklinker1 Hi! I think I know why. I checked the @ vite/plugin vue source code and found that it's because wxt starts the vite server, and every time the file changes, wxt executes the vite build. Are these two using the same vite context? Due to file changes, vite triggers the plugin vue's handleHotUpdate method and sets the code change cache. Later, when wxt executes vite build, the script obtained is the cache set by handleHotUpdate, resulting in an error. But I still don't understand why there is no cache after setting sourceMap to false。 I wonder if it's possible to use a separate configuration in the vite build of wxt? Context sharing for separating vite server and vite build? |
The reason WXT's |
https://vitejs.dev/guide/api-javascript.html#createserver |
Hmm, WXT should be setting the mode explicitly. See https://github.com/wxt-dev/wxt/blob/main/src%2Fcore%2Fbuilders%2Fvite%2Findex.ts#L39 Interesting idea to spawn a child process, that would definitely break the shared cache. Would be difficult to control though :/ |
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
git clone [email protected]:tjx666/open-related-websites.git
git reset --hard ef81483a71bf2345def48aa2df423b3df1119b94
pnpm dev
entrypoints/content/Search.vue
and change the content, page will reload but content script doesn't updatedentrypoints/content/Search.vue
for exampleconsole.log(123)
, will cause crash and wxt dev process exitExpected behavior
entrypoints/content/Search.vue
should not cause wxt exit.Screenshots
console output
Environment
The text was updated successfully, but these errors were encountered: