Skip to content

adding imports to background/index.ts breaks the extension #89

@abdullah-tsx

Description

@abdullah-tsx
export const sendToContentScript = <T extends object>(
	message: ToastMessage,
) => {
	chrome.tabs.query({ active: true, currentWindow: true }, tabs => {
		if (tabs.length > 0 && tabs[0].id !== undefined) {
			const activeTabId = tabs[0].id;
			chrome.tabs.sendMessage(activeTabId, message, (response: string) => {
				console.log(response);
			});
		}
	});
};

if this function is defined in background/index.ts it works just fine if i export it to another file background/utils.ts and then import it `import {sendToContentScript} from './utils'. the service worker fails to register and extension keeps flickering.

edit this is not limited to this function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions