ReactでChrome拡張を開発するためのテンプレート
- "react": "^17.0.2",
- "typescript": "^4.1.2"
- "node-sass": "^5.0.0",
- Chrome拡張のボタンから"拡張機能を管理"を開く
- "パッケージ化されていない拡張機能を読み込む"をクリックしてbuildディレクトリを選択
- 新しいタブを開くと以下のようなエラーが出てきます
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'sha256-xxx'". Either the 'unsafe-inline' keyword, a hash ('sha256-*****'), or a nonce ('nonce-...') is required to enable inline execution.
public/manifesct.jsonのcontent_security_policyの'sha256-xxx'の部分をエラー文のsha256-*****に置き換える
- もう一度buildしてページを読み込むとファイルが見れます