reactjs - 使用 React.js 的 Chrome 扩展程序导致“清单文件丢失或无法读取”错误
问题描述
Manifest file is missing or unreadable
尝试加载解压的 Chrome 扩展程序时遇到错误。我将扩展构建为一个反应应用程序,因此文件结构如下所示:
我知道manifest.json
需要在根文件夹中,而不是public
通常反应的方式。但是,当我将其移至根目录时,它会中断与我的连接,并且我的弹出窗口仅在未连接任何 javascript 的情况app.js
下加载。index.html
这就是我的清单的布局方式:
{
"manifest_version": 2,
"name": "My Extension",
"description": "This extension is a starting point to create a real Chrome extension",
"version": "0.0.1",
"browser_action": {
"default_popup": "index.html",
"default_title": "Open the popup"
},
"icons": {
"16": "/public/images/get_started16.png",
"48": "/public/images/get_started48.png",
"128": "/public/images/get_started128.png"
},
"permissions": [
]
}
解决方案
不确定自从有人回答以来您是否已经弄清楚了这一点,但是一旦您完成了,就去做npm run build
。这应该创建您的“构建”,它将包含您的清单文件,然后加载未打包的“构建”文件夹。
希望这可以帮助。
推荐阅读
- javascript - 检查 JavaScript 中是否存在通知
- javascript - 无法让 audio.play() 和 audio.pause() 工作
- html - 使用 CSS 的响应式侧边栏交互
- regex - 用正则表达式匹配ruby中的字符串后获取数字
- python - 优化 numpy 数组创建
- php - Cors 在 Laravel 6 和 vue js 2 中不起作用
- jquery - Jquery获取下拉标签并制作默认选择选项项目占位符
- azure-devops - nuget.build.tasks.pack - 需要构建错误作者
- python - 请解释这段代码的结论
- tensorflow - clamp_ 在 pytorch 中做了什么以及如何将其更改为 tensorflow 2.0?