You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Manifest V3下无法访问chrome.sidePanel API的原因咨询

问题分析与解决

核心原因

你使用的@types/chrome版本(0.0.237)过旧,该版本的类型定义尚未包含chrome.sidePanel API的相关声明。chrome.sidePanel是Chrome 114新增的API,而@types/chrome 0.0.237对应的类型定义还未同步更新这部分内容。

解决方案

  1. 升级@types/chrome依赖
    在项目根目录执行以下命令,将@types/chrome升级到支持sidePanel API的版本(建议升级到0.0.240及以上版本):

    npm install @types/chrome@latest --save-dev
    

    或者指定具体版本:

    npm install @types/chrome@0.0.240 --save-dev
    
  2. 修正manifest配置格式
    确认manifest.json中的权限配置符合Manifest V3的语法规范,permissions应为数组形式:

    "permissions": ["sidePanel"]
    

    你当前的写法"permissions": "sidePanel"不符合标准语法,修正后可避免潜在的配置解析问题。

额外操作

升级依赖后,通过VSCode快捷键Ctrl+Shift+P执行TypeScript: Restart TS Server,重启TypeScript语言服务即可让新的类型定义生效,无需重启电脑。

内容的提问来源于stack exchange,提问作者KriBir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 09:13:18