mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
fix: vite requesting undefined, for some reason after the connect iframe was removed
This commit is contained in:
@@ -242,10 +242,14 @@ const workerPlugin = (): Plugin => ({
|
||||
transform(_code, id) {
|
||||
if (/\/workers\/[^/]+\/index\.ts$/.test(id) || /pinger\/pingWorker.ts$/.test(id)) {
|
||||
// Return a virtual module that creates a web worker
|
||||
console.log('[VITE] Transforming worker:', id);
|
||||
|
||||
return {
|
||||
code: `
|
||||
const worker = () => new Worker(new URL('${id}', import.meta.url), { type: 'module' });
|
||||
const worker = () => {
|
||||
console.log('[VITE] Creating worker from:', '${id}');
|
||||
return new Worker(new URL('${id}', import.meta.url), { type: 'module' });
|
||||
};
|
||||
export default worker;
|
||||
`,
|
||||
// Use an empty source map to preserve the original file's mapping
|
||||
@@ -478,6 +482,8 @@ export default defineConfig({
|
||||
// Exclude WebAssembly modules
|
||||
'@trezor/crypto-utils',
|
||||
'@trezor/utxo-lib',
|
||||
// Exclude transport to prevent pre-bundling issues with bridge URL construction
|
||||
'@trezor/transport',
|
||||
],
|
||||
},
|
||||
server: {
|
||||
|
||||
Reference in New Issue
Block a user