fix: disable modulePreload polyfill for Chrome MV3 compatibility
CI / test (pull_request) Successful in 18s

Vite was injecting modulepreload-polyfill.js into the built output, which
Chrome rejected at runtime with: 'A preload for .../modulepreload-polyfill.js
is found, but is not used because it is a cross-world extension resource
mismatch.'

Disabling the polyfill (extension context does not need it — Chrome 110+
supports bare ESM natively) removes the offending chunk entirely.
This commit is contained in:
robot committed 2026-08-12 03:13:07 +00:00
1 parent 8794218ee8
commit 88585a29bf
1 file changed
+4
+4
View File
@@ -49,8 +49,12 @@ export default defineConfig({
}, },
], ],
build: { build: {
target: 'chrome110',
outDir: '../dist', outDir: '../dist',
emptyOutDir: true, emptyOutDir: true,
modulePreload: {
polyfill: false,
},
rollupOptions: { rollupOptions: {
input: { input: {
background: resolve(__dirname, 'src/background/background.js'), background: resolve(__dirname, 'src/background/background.js'),