Skip to content

Commit

Permalink
Added WebExt compat util #98
Browse files Browse the repository at this point in the history
  • Loading branch information
XFox111 committed Nov 20, 2022
1 parent 499dc83 commit 7b2867f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.54.9",
"typescript": "^4.4.2"
"typescript": "^4.4.2",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@craco/craco": "^6.4.5",
Expand All @@ -17,6 +18,7 @@
"@types/node": "^18.7.16",
"@types/react": "^18.0.18",
"@types/react-dom": "^18.0.6",
"@types/webextension-polyfill": "^0.9.1",
"html-webpack-plugin": "^5.5.0",
"react-scripts": "^5.0.1"
},
Expand Down
4 changes: 4 additions & 0 deletions src/Utils/ext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Browser from "webextension-polyfill";

const ext: typeof Browser | null = (process.env.NODE_ENV !== "development") ? require("webextension-polyfill") : null;
export default ext;
3 changes: 3 additions & 0 deletions src/Utils/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ext from "./ext";

export { ext };
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2812,6 +2812,11 @@
dependencies:
source-map "^0.6.1"

"@types/webextension-polyfill@^0.9.1":
version "0.9.1"
resolved "https://registry.yarnpkg.com/@types/webextension-polyfill/-/webextension-polyfill-0.9.1.tgz#fcb5c352e2e461d0287774db89bc326b15b47844"
integrity sha512-6aNzPIhqKlAV9t06nwSH3/veAceYE2dS2RVFZI8V1+UXHqsFNB6cRwxNmheiBvEGRc45E/gyZNzH0xAYIC27KA==

"@types/webpack-dev-server@^3.11.6":
version "3.11.6"
resolved "https://registry.yarnpkg.com/@types/webpack-dev-server/-/webpack-dev-server-3.11.6.tgz#d8888cfd2f0630203e13d3ed7833a4d11b8a34dc"
Expand Down Expand Up @@ -9332,6 +9337,11 @@ wbuf@^1.1.0, wbuf@^1.7.3:
dependencies:
minimalistic-assert "^1.0.0"

webextension-polyfill@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz#ccb28101c910ba8cf955f7e6a263e662d744dbb8"
integrity sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g==

webidl-conversions@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
Expand Down

0 comments on commit 7b2867f

Please sign in to comment.