Skip to content

Commit 49fe9e8

Browse files
committed
officially migrated to manifest v3
1 parent ec28fa1 commit 49fe9e8

File tree

14 files changed

+56
-45
lines changed

14 files changed

+56
-45
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@
1111

1212
## Announcements
1313

14-
- **_Recently updated from React ~~16~~ to 17 and Webpack ~~4~~ to 5!_**
15-
- **_Recently added [TypeScript](https://www.typescriptlang.org/) Support!_**
16-
- **_Recently added [devtools](https://developer.chrome.com/docs/extensions/mv3/devtools/) Support! Thanks [GeekaholicLin](https://github.com/lxieyang/chrome-extension-boilerplate-react/issues/17)!_**
14+
- **_This boilerplate adopts [Manifest V3](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/)!_** For V2 users, please check out the [manifest-v2](https://github.com/lxieyang/chrome-extension-boilerplate-react/tree/manifest-v2) branch, or use version [3.x](https://www.npmjs.com/package/chrome-extension-boilerplate-react/v/3.3.0).
15+
- Check out the [Manifest V3 Migration Guide](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/).
16+
- Recently added [devtools](https://developer.chrome.com/docs/extensions/mv3/devtools/) Support! Thanks [GeekaholicLin](https://github.com/lxieyang/chrome-extension-boilerplate-react/issues/17)!
17+
- Recently updated from React ~~16~~ to **17** and Webpack ~~4~~ to **5**!
18+
- Recently added [TypeScript](https://www.typescriptlang.org/) Support!
1719

1820
## Features
1921

2022
This is a basic Chrome Extensions boilerplate to help you write modular and modern Javascript code, load CSS easily and [automatic reload the browser on code changes](https://webpack.github.io/docs/webpack-dev-server.html#automatic-refresh).
2123

2224
This boilerplate is updated with:
2325

26+
- [Chrome Extension Manifest V3](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/)
2427
- [React 17](https://reactjs.org)
2528
- [Webpack 5](https://webpack.js.org/)
2629
- [React Hot Loader](https://github.com/gaearon/react-hot-loader)

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chrome-extension-boilerplate-react",
3-
"version": "3.3.0",
3+
"version": "4.0.0",
44
"description": "A chrome extension boilerplate built with React 17 and Webpack 5",
55
"license": "MIT",
66
"repository": {

src/manifest.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
2+
"manifest_version": 3,
23
"name": "Chrome Extension with React & Webpack",
34
"options_page": "options.html",
4-
"background": {
5-
"page": "background.html"
6-
},
7-
"browser_action": {
5+
"background": [
6+
{
7+
"service_worker": ["background.bundle.js"]
8+
}
9+
],
10+
"action": {
811
"default_popup": "popup.html",
912
"default_icon": "icon-34.png"
1013
},
@@ -23,10 +26,9 @@
2326
],
2427
"devtools_page": "devtools.html",
2528
"web_accessible_resources": [
26-
"content.styles.css",
27-
"icon-128.png",
28-
"icon-34.png"
29-
],
30-
"manifest_version": 2,
31-
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
32-
}
29+
{
30+
"resources": ["content.styles.css", "icon-128.png", "icon-34.png"],
31+
"matches": []
32+
}
33+
]
34+
}

src/pages/Background/index.html

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/pages/Background/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
import '../../assets/img/icon-34.png';
2-
import '../../assets/img/icon-128.png';
3-
41
console.log('This is the background page.');
52
console.log('Put the background scripts here.');

src/pages/Newtab/Newtab.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Newtab = () => {
1717
target="_blank"
1818
rel="noopener noreferrer"
1919
>
20-
Learn React
20+
Learn React!
2121
</a>
2222
<h6>The color of this paragraph is defined using SASS.</h6>
2323
</header>

src/pages/Newtab/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ import Newtab from './Newtab';
55
import './index.css';
66

77
render(<Newtab />, window.document.querySelector('#app-container'));
8+
9+
if (module.hot) module.hot.accept();

src/pages/Options/index.tsx renamed to src/pages/Options/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ render(
88
<Options title={'settings'} />,
99
window.document.querySelector('#app-container')
1010
);
11+
12+
if (module.hot) module.hot.accept();

src/pages/Panel/index.tsx renamed to src/pages/Panel/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ import Panel from './Panel';
55
import './index.css';
66

77
render(<Panel />, window.document.querySelector('#app-container'));
8+
9+
if (module.hot) module.hot.accept();

0 commit comments

Comments
 (0)