fix(electron): suppress DevTools source map error for Capacitor SQLite plugin

Remove sourceMappingURL comment from plugin.js in @capacitor-community/sqlite to
prevent Electron DevTools from attempting to load the source map via the custom
capacitor-electron:// protocol. This eliminates harmless but noisy 404 warnings
in development. No impact on runtime or debugging.

- Remove //# sourceMappingURL=plugin.js.map from plugin.js
- Confirmed plugin.js.map exists for manual inspection if needed
- No changes to app logic or build process
This commit is contained in:
Matthew Raymer
2025-07-11 06:45:35 +00:00
parent 2e6cf612e6
commit cd1e46d5f2
3 changed files with 24 additions and 6 deletions

View File

@@ -62,6 +62,27 @@ export default defineConfig(async () => {
};
}
}
},
// Plugin to suppress source map loading for external modules
{
name: 'suppress-source-maps',
transformIndexHtml(html) {
// Add script to suppress source map loading errors
const script = `
<script>
// Suppress source map loading errors for external modules
const originalFetch = window.fetch;
window.fetch = function(url, options) {
if (typeof url === 'string' && url.includes('.map')) {
console.log('[Source Map] Suppressed loading of:', url);
return Promise.resolve(new Response('', { status: 404 }));
}
return originalFetch(url, options);
};
</script>
`;
return html.replace('</head>', script + '</head>');
}
}
],