first commit
This commit is contained in:
17
vite-plugins/error-overlay-plugin.js
Normal file
17
vite-plugins/error-overlay-plugin.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { errorOverlayCode } from './ErrorOverlay.js';
|
||||
|
||||
|
||||
export function errorOverlayPlugin() {
|
||||
return {
|
||||
name: 'error-overlay',
|
||||
transform(code, id, opts = {}) {
|
||||
if (opts?.ssr) return;
|
||||
|
||||
if (!id.includes('vite/dist/client/client.mjs')) return;
|
||||
|
||||
console.log("🔥 [custom-error-overlay] patching overlay", id);
|
||||
|
||||
return code.replace('class ErrorOverlay', errorOverlayCode + '\nclass OldErrorOverlay');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user