Answer the question
In order to leave comments, you need to log in
How to make js import another js in chrome extention?
Hey!
Is it possible to somehow import the code of another js into js?
For example, there is a js file that contains basic scripts that are called in many other functions. When it's all in a single file, then everything is fine, but when this file becomes too large, then you already think about dividing the plugin's functionality into, so to speak, "modules". Each module is responsible for its own functionality. However, the same functions are called in each module.
Actually, I want to highlight all such functions in some kind of base.js and import them into other js files.
How can I do this if you consider that I have an extention, and not just code on the site.
Answer the question
In order to leave comments, you need to log in
Have you read this?
https://developer.chrome.com/extensions/content_sc...
Declaratively injected scripts are registered in the manifest under the "content_scripts" field. They can include JavaScript files, CSS files or both. All auto-run content scripts must specify match patterns.
{
"name": "My extension",
...
"content_scripts": [
{
"matches": [" http://*.nytimes.com/* "],
"css": ["myStyles.css"] ,
"js": ["contentScript.js"]
}
],
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question