[英]How can I quickly test changes when developing a Chrome Extension using ReactJS?
I'm trying to use npm run
to test my chrome extension, however I get expected errors saying 'chrome' is undefined. 我正在尝试使用
npm run
测试我的chrome扩展程序,但是我得到预期的错误,提示“ chrome”未定义。
I use their API to store user data using chrome.storage.sync
, runtime checks chrome.runtime.lastError
, and tab info like chrome.tabs.query(...)
. 我使用他们的API使用
chrome.storage.sync
存储用户数据,运行时检查chrome.runtime.lastError
和选项卡信息,例如chrome.tabs.query(...)
。
Right now the issue is I need to 1) npm run build
, 2) upload / refresh the extension in the Extensions tab, and then finally take a look if the changes applied, or if there is any issues. 现在的问题是我需要1)
npm run build
,2)在“扩展”选项卡中上传/刷新扩展,然后最后查看是否应用了更改,或者是否有任何问题。
I have found an npm package that allows me to use storage called chrome-storage
( https://www.npmjs.com/package/chrome-storage ), but I'm assuming there is a better way to do this? 我找到了一个npm软件包,该软件包可以让我使用称为
chrome-storage
( https://www.npmjs.com/package/chrome-storage ) chrome-storage
,但是我假设有一种更好的方法可以做到这一点? I just want to make changes in my IDE and have it auto update the browser window so I see changes (which I usually get from reactjs). 我只想在我的IDE中进行更改,并使其自动更新浏览器窗口,以便我看到更改(通常是从reactjs中获得的)。
I just want to make changes in my IDE and have it auto update the browser window so I see changes (which I usually get from reactjs).
我只想在我的IDE中进行更改,并使其自动更新浏览器窗口,以便我看到更改(通常是从reactjs中获得的)。
It seems you want a boilerplate with the "hot reload" feature supported. 似乎您需要支持“热重装”功能的样板。 Check those out for example: react-chrome-extension-boilerplate , crossbuilder .
例如,检查一下: react-chrome-extension-boilerplate , crossbuilder 。 But from my experience you mostly still need to reload the current page in the browser to see changes (depends on what kind of changes).
但是根据我的经验,您仍然仍然需要在浏览器中重新加载当前页面才能看到更改(取决于哪种更改)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.