首页 > 解决方案 > 加载未打包的 Chrome 扩展程序 - 它如何知道我的 index.html 文件在哪里?

问题描述

我有一个 Chrome 扩展项目,结构如下所示:

project/
  dist/
    index.html
  manifest.json

当我去更多工具->扩展->加载解压扩展

我选择了项目的根目录,它可以工作!但我不知道它是如何知道加载的dist/index.html?该manifest.json文件没有说明任何内容dist/index.html,那么 Chrome 是如何知道如何加载扩展程序的呢?

几个月前我构建了这个扩展,现在我不知道它是如何工作的,哈哈。

manifest.json文件看起来像这样:

{
  "manifest_version": 2,
  "name": "Suman Generator",
  "description": "This extension allows the user to generate test skeletons.",
  "version": "1.223",
  "browser_action": {
    "default_icon": "icon.png"
  },
  "options_page": "options.html",
  "options_ui": {
    "page": "options.html",
    "chrome_style": true
  },
  "devtools_page": "aspects/dev-tools/dist/suman-dev-tools.html",
  "optional_permissions": [
    "<all_urls>"
  ],
  "permissions": [
    "management",
    "activeTab",
    "webNavigation",
    "storage",
    "*://*/",
    "http://*/",
    "https://*/",
    "background",
    "browser",
    "tabs",
    "identity",
    "identity.email",
    "https://www.googleapis.com/",
    "pageAction",
    "notifications",
    "clipboard",
    "clipboardWrite",
    "clipboardRead",
    "unlimitedStorage",
    "webRequest",
    "userinfo",
    "webRequestBlocking",
    {
      "socket": [
        "tcp-connect:*:*"
      ]
    }
  ],
  "web_accessible_resources": [
    "modal-iframe.html"
  ],
  "icons": {
    "16": "icons/icon16.png",
    "48": "icons/icon48.png",
    "128": "icons/icon128.png"
  },
  "omnibox": {
    "keyword": "suman:chrome"
  },
  "oauth2": {
    "client_id": "5461307462-7geu9374.apps.googleusercontent.com",
    "scopes": [
      "https://www.googleapis.com/auth/userinfo.profile",
      "https://www.googleapis.com/auth/chromewebstore.readonly"
    ]
  },
  "key": "MIIBC57LwMgUdRxfY4I40oAiKy57o3tWF/A1BrTNY0nQIDAQAB",
  "short_name": "Suman Short Name",
  "offline_enabled": true,
  "background": {
    "page": "background.html",
    "persistent": true
  },
  "content_scripts": [],
  "content_security_policy": "script-src 'self' https://plus.google.com 'unsafe-inline' 'http' 'https' 'unsafe-eval' '*'; object-src '*';"
}

标签: google-chromegoogle-chrome-extension

解决方案


推荐阅读