I am trying to create a Chrome extension. But when I build the extension file, it shows following error:
Following are the codes that I’ve written so far,
manifest.json
"name": "Text Highlighter",
"description": "Finds any instance of specified text in a webpage and highlights it.",
"version": "1.0",
"manifest_version": 3,
"action": {
"default_popup": "popup.html"
},
"host_permissions": ["http://*/*", "https://*/*"],
"permissions": ["activeTab", "scripting"]
}
popup.js
const searchButton = document.getElementById("search-button");
searchButton.addEventListener("click", async () => {
const textInput = document.getElementById("search-text").value;
console.log(textInput);
let [tab] = await chorme.tabs.query({ active: true, currentWindow: true });
chrome.scripting.executeScript({
target: { tabId: tab.id },
func: searchAndHighlightInputText,
});
});
const searchAndHighlightInputText = () => {
alert("hello!");
};
popup.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Highlighter</title>
</head>
<body>
<label for="search-string">Text to search: </label>
<input type="text" name="search-text" id="search-text">
<input type="submit" id="search-button" value="Search">
<script src="popup.js"></script>
</body>
</html>```