First, make sure you have Node.js and npm (Node Package Manager) installed on your computer. If you don't have these already, you can download and install them from the official website (https://nodejs.org/).
Next, create a new directory for your extension and navigate to it in your terminal.
In the terminal, run the following command to create a new React app:
npx create-react-app my-extension
cd my-extension
{
"manifest_version": 3,
"name": "My Extension",
"description": "A simple Chrome extension",
"version": "1.0",
"permissions": [
"activeTab"
],
"action": {
"default_title": "My Extension",
"default_popup": "index.html"
}
}
<!DOCTYPE html>
<html>
<head>
<title>My Extension</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
npm run build
This will create a "build" directory with the compiled version of your app.
Your extension should now be installed and working in Chrome! You can test it by clicking the extension's icon in the browser toolbar.