From 13b0fd63bb49a2d9efd06aab432680a4c0486989 Mon Sep 17 00:00:00 2001 From: crimx Date: Wed, 8 Jul 2020 14:18:19 +0800 Subject: [PATCH] refactor: add livereload arguments --- README.md | 3 +++ lib/WexExtManifestPlugin.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ce9f83..bff0f92 100644 --- a/README.md +++ b/README.md @@ -276,6 +276,9 @@ yarn build --livereload # specify browser application yarn build --livereload=firefox + +# with arguments +yarn build --livereload=google-chrome --livereloadargs='--profile-directory=Profile 1' ``` Behind the scene whenever webpack finishes bundling, it opens a special url in the browser running the extension. The url is then captured by the injected script which notifies the extension to reload itself. diff --git a/lib/WexExtManifestPlugin.js b/lib/WexExtManifestPlugin.js index 3580094..171d6ef 100644 --- a/lib/WexExtManifestPlugin.js +++ b/lib/WexExtManifestPlugin.js @@ -163,9 +163,13 @@ class WexExtManifestPlugin { if (argv.livereload) { if (typeof argv.livereload === 'string') { + const app = [argv.livereload] + if (argv.livereloadargs) { + app.push(argv.livereloadargs) + } await open( 'http://neutrino-webextension.reloads', - { app: argv.livereload, background: true } + { app, background: true } ) } else { await open(