1. chrome插件开发时,热更新不完全生效发现问题
在编写 chrome 插件开发模板 的时候,遇到了 webpack 的 热更新不完全生效 的问题。
-
不生效情景:
当 chrome 插件的 manifest.json 中的 background, content_scripts 被配置为 js 的形式时(如下),这些脚本必须在文件目录中存在(注意:background 的 scripts 和 content_scripts 的 js 两个属性是不能使用远程链接的)。
{ "background": { "persistent": false, "scripts": ["background.js"] }, "content_scripts": [ { "matches": ["http://*/*", "https://*/*"], "js": ["content.js"], "all_frames": true } ], } 复制代码
-
生效情景: 当 chrome 插件的 manifest.json 中的 background, popup 被配置为 html(js 在 html 中被以 远程链接 的形式引入) 的形式时(如下),
{ "browser_action": { "default_popup": "pages/popup.html" }, "background": { "persistent": false, "pag