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

Proposal: Add minimal extension sample where content_scripts import shared logic #1355

Open
hamirmahal opened this issue Nov 21, 2024 · 2 comments

Comments

@hamirmahal
Copy link

It'd be nice if this sample used TypeScript.

@oliverdunk
Copy link
Member

Hi @hamirmahal, did you have a particular implementation in mind? At the moment, we don't have a good way of doing this, so my suggestion would be to use a bundler to generate a single file at build time. In the future, we'd like to make that easier - there are some workarounds some tooling uses based on web_accessible_resources but this isn't ideal and probably isn't something we would encourage.

As for TypeScript, we generally try to avoid that in samples as it adds an extra layer for developers to understand - I think one or two TypeScript samples wouldn't be a bad idea though.

@hamirmahal
Copy link
Author

Hello @oliverdunk, thanks for the quick response. Matching developer expectations as much as possible would be ideal.

If

import sharedLogic from './sharedLogic';

"just worked" in contentScript1.js and contentScript2.js, that'd be great.

Which bundler do you recommend for someone prioritizing type safety, ease of use, and simplicity?

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

2 participants