Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
abdullah-tsx opened this issue Aug 14, 2024 · 0 comments
Open

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

abdullah-tsx opened this issue Aug 14, 2024 · 0 comments

Comments

@abdullah-tsx
Copy link

abdullah-tsx commented Aug 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant