Skip to content

Commit f6cefc3

Browse files
authored
Add webpack-extension-reloader (OctoLinker#704)
1 parent 1030159 commit f6cefc3

File tree

4 files changed

+162
-5
lines changed

4 files changed

+162
-5
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To build and run the extension follow these steps.
1919
* Chrome (Quickstart):
2020
1. `npm run chrome-open`
2121
* Chrome (Long Version):
22-
1. To build the extension once run `npm run build` or `npm run watch` during development.
22+
1. To build the extension once run `npm run build` or `npm start` during development.
2323
1. Load extension https://developer.chrome.com/extensions/getstarted#unpacked.
2424

2525
[CSS]: https://github.com/OctoLinker/OctoLinker/commit/ccbefb7

package-lock.json

Lines changed: 146 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"release:amo": "cd dist && npm run patch-permissions && webext submit",
1919
"release": "npm run release:cws",
2020
"build": "webpack --mode=production",
21-
"watch": "webpack --watch --mode=development",
21+
"start": "webpack --watch --mode=development",
2222
"chrome-open": "npm run build && npm run chrome-launch --",
2323
"chrome-launch": "node scripts/chrome-launch.js",
2424
"firefox-open": "npm run build && npm run firefox-launch --",
@@ -66,7 +66,8 @@
6666
"web-ext": "^3.0.0",
6767
"webext": "1.9.1-with-submit.1",
6868
"webpack": "^4.40.2",
69-
"webpack-cli": "^3.3.4"
69+
"webpack-cli": "^3.3.4",
70+
"webpack-extension-reloader": "^1.1.4"
7071
},
7172
"optionalDependencies": {
7273
"fsevents": "2.1.2"

webpack.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const webpack = require('webpack');
33
const CopyWebpackPlugin = require('copy-webpack-plugin'); // eslint-disable-line
4+
const ExtensionReloader = require('webpack-extension-reloader');
45

56
module.exports = (env, argv) => ({
67
mode: 'development',
@@ -17,7 +18,17 @@ module.exports = (env, argv) => ({
1718
plugins: [
1819
new CopyWebpackPlugin([{ from: 'assets' }]),
1920
new webpack.EnvironmentPlugin(['OCTOLINKER_LIVE_DEMO']),
20-
],
21+
argv.mode === 'development'
22+
? new ExtensionReloader({
23+
port: 9090,
24+
reloadPage: true,
25+
entries: {
26+
contentScript: ['app'],
27+
background: 'background',
28+
},
29+
})
30+
: false,
31+
].filter(Boolean),
2132
module: {
2233
rules: [
2334
{

0 commit comments

Comments
 (0)