结合VSCode插件Run on Save和Chrome插件Extensions Reloader实现保存源码文件时自动重新加载拓展程序(Hot Reload)
当前在Windows环境下测试通过,其他系统未测试
-
在Chrome浏览器安装插件Extensions Reloader
-
在Chrome浏览器地址栏上填入
chrome://extensions/shortcuts
跳转到快捷键设置页面,保持默认的Alt+Shift+R
不变,并将Extensions Reloader下设置Reload all extensions in development
为Global
-
在Vscode安装插件Run on Save
-
npm run watch
-
打开Chrome浏览器页面
-
修改并保存源代码文件(当前监听的文件夹为src,如需自定义,请编辑
.vscode/settings.json
下的emeraldwalk.runonsave->commands->match) -
Extensions Reloader插件会显示OK字样,Chrome插件自动刷新完成
- https://solomonvictorino.com/reload-chrome-extensions-on-save-vs-code/
- 请问 windows 上如何通过一行命令实现模拟按键(ctrl+v)? 正文里有 mac 端的实现
- https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/sendkeys-statement
config/
: Webpack configuration for this project.public/
: HTML files for the override page.manifest.json
: Extension configuration.
src/
: Source files for the override page. See chrome docs for more details..gitignore
: Lists files to be ignored in your Git repo.package.json
: Contains project configuration, scripts, and dependencies.
npm run watch
- Open chrome://extensions.
- Enable developer mode (top right of page).
- Click "Load unpacked extension" (top left page).
- Select this directory.
To package the source code into static files for the Chrome webstore, execute npm run build
.
Refer to the Chrome developer documentation to get started.
Refer to github.com/gadhagod/vscode-chrome-extension-developer-tools/blob/master/README.md#commands.