question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keep contentScripts individual

See original GitHub issue

Hi,

I find the vitesse-webext project contains only one index.global.js under contentScripts. If I want to keep contentScript individual, what should I do?

There are some build configs in vite.config.content.ts file, but I not so familiar with vite, could you please give me some example?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
tmkxcommented, Dec 20, 2021

it does not support multi entrypoints(or glob) yet. There are some ways to do that:

  1. bundle all components into contentScripts/index.ts, and use them at your needs
  2. copy vite.config.content.ts, and change build.lib.entry, manifest.ts to add a new content-script file
0reactions
jacktangcommented, Dec 20, 2021

Let clear the question again. I want to keep vue component in current index.ts and keep other content scripts in individual files because they will be inserted into tab page in different life cycle and with different functions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to keep the content script injected in a tab even if user ...
I have solved the problem. What I have done is, I have a listener to check if clicked object is hyperlink in my...
Read more >
Content scripts - Mozilla - MDN Web Docs
A content script is a part of your extension that runs in the context of a particular web page (as opposed to background...
Read more >
Chrome Extensions: Content Scripts - Programming with Text
In this video, I cover " content scripts " for chrome extensions. The content script is a JavaScript file that runs in the...
Read more >
How to keep the content script alive in a tab even if user ...
So there is no way to keep a content script's js context alive. The solution to this is to use chrome.storage (https://developer.chrome.com/extensions/storage) ...
Read more >
Chrome Extension — When to use content scripts and injected ...
As stated above, content scripts can access the embedding page's DOM. This gives a lot of power to the script as it can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found