Giter Site home page Giter Site logo

rubenspgcavalcante / webpack-extension-reloader Goto Github PK

View Code? Open in Web Editor NEW
493.0 6.0 78.0 5.69 MB

A upgrade from 🔥webpack-chrome-extension-reloader🔥, now on all browsers

License: MIT License

TypeScript 94.59% JavaScript 5.41%
webpack hot-reloading extensions browser-extension webpack-plugin

webpack-extension-reloader's Introduction

Webpack Extension Reloader

A Webpack plugin to automatically reload browser extensions during development.

npm version Test Status NPM Downloads Codacy Badge Greenkeeper badge

Installing

npm

npm install webpack-extension-reloader --save-dev

yarn

yarn add webpack-extension-reloader --dev

Solution for ...

Have your ever being annoyed while developing a browser extension, and being unable to use webpack-hot-server because it's not a web app but a browser extension?

Well, now you can have automatic reloading!

Note: This plugin doesn't allow Hot Module Replacement (HMR) yet.

What it does?

Basically something similar to what the webpack hot reload middleware does. When you change the code and the webpack trigger and finish the compilation, your extension is notified and then reloaded using the standard browser runtime API.
Check out Hot reloading extensions using Webpack for more background.

How to use

Using as a plugin

Add webpack-extension-reloader to the plugins section of your webpack configuration file. Note that this plugin don't outputs the manifest (at most read it to gather information). For outputing not only the manifest.json but other static files too, use CopyWebpackPlugin.

const ExtensionReloader  = require('webpack-extension-reloader');

plugins: [
  new ExtensionReloader(),
  new CopyWebpackPlugin([
      { from: "./src/manifest.json" },
      { from: "./src/popup.html" },
    ]),
]

You can point to your manifest.json file...

plugins: [
  new ExtensionReloader({
    manifest: path.resolve(__dirname, "manifest.json")
  }),
  // ...
]

... or you can also use some extra options (the following are the default ones):

// webpack.dev.js
module.exports = {
  mode: "development", // The plugin is activated only if mode is set to development
  watch: true,
  entry: {
    'content-script': './my-content-script.js',
    background: './my-background-script.js',
    popup: 'popup',
  },
  //...
  plugins: [
    new ExtensionReloader({
      port: 9090, // Which port use to create the server
      reloadPage: true, // Force the reload of the page also
      entries: { // The entries used for the content/background scripts or extension pages
        contentScript: 'content-script',
        background: 'background',
        extensionPage: 'popup',
      }
    }),
    // ...
  ]
}

Note I: entry or manifest are needed. If both are given, entry will override the information comming from manifest.json. If none are given the default entry values (see above) are used.

And then just run your application with Webpack in watch mode:

NODE_ENV=development webpack --config myconfig.js --mode=development --watch 

Note II: You need to set --mode=development to activate the plugin (only if you didn't set on the webpack.config.js already) then you need to run with --watch, as the plugin will be able to sign the extension only if webpack triggers the rebuild (again, only if you didn't set on webpack.config).

Multiple Content Script and Extension Page support

If you use more than one content script or extension page in your extension, like:

entry: {
  'my-first-content-script': './my-first-content-script.js',
  'my-second-content-script': './my-second-content-script.js',
  // and so on ...
  background: './my-background-script.js',
  'popup': './popup.js',
  'options': './options.js',
  // and so on ...
}

You can use the entries.contentScript or entries.extensionPage options as an array:

plugins: [
  new ExtensionReloader({
    entries: { 
      contentScript: ['my-first-content-script', 'my-second-content-script', /* and so on ... */],
      background: 'background',
      extensionPage: ['popup', 'options', /* and so on ... */],
    }
  }),
  // ...
]

CLI

If you don't want all the plugin setup, you can just use the client that comes with the package.
You can use by installing the package globally, or directly using npx:

npx webpack-extension-reloader

If you run directly, it will use the default configurations, but if you want to customize you can call it with the following options:

npx webpack-extension-reloader --config wb.config.js --port 9080 --no-page-reload --content-script my-content.js --background bg.js --extension-page popup.js

If you have multiple content scripts or extension pages, just use comma (with no spaces) while passing the option

npx webpack-extension-reloader --content-script my-first-content.js,my-second-content.js,my-third-content.js --extension-page popup.js,options.js

Client options

name default description
--help Shows this help
--config webpack.config.js The webpack configuration file path
--port 9090 The port to run the server
--manifest The path to the extension manifest.json file
--content-script content-script The entry/entries name(s) for the content script(s)
--background background The entry name for the background script
--extension-page popup The entry/entries name(s) for the extension pages(s)
--no-page-reload Disable the auto reloading of all pages which runs the plugin

Every time content or background scripts are modified, the extension is reloaded :)
Note: the plugin only works on development mode, so don't forget to set the NODE_ENV before run the command above

Contributing

Please before opening any issue or pull request check the contribution guide.

License

This project is under the MIT LICENSE

webpack-extension-reloader's People

Contributors

conorsheehan1 avatar dependabot[bot] avatar franciscolourenco avatar greenkeeper[bot] avatar kadauchi avatar mannybatth avatar rubenspgcavalcante avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

webpack-extension-reloader's Issues

An in-range update of mini-css-extract-plugin is breaking the build 🚨

The devDependency mini-css-extract-plugin was updated from 0.8.0 to 0.8.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mini-css-extract-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

Release Notes for v0.8.1

0.8.1 (2019-12-17)

Bug Fixes

Commits

The new version differs by 7 commits.

  • 054532a chore(release): 0.8.1
  • 2f72e1a fix: support ES module syntax (#472)
  • c7eda97 refactor: only output when any chunk is fulfilled (#468)
  • 357d073 fix: improve warning of conflict order (#465)
  • 50434b5 refactor: loader's code (#448)
  • 159ce3b refactor: fix typo (#440)
  • 0bacfac fix(options): use filename mutated after instantiation (#430)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

is there a way to trigger a reload outside of the plugin?

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Linux KDE Neon
  • Browser: Chrome Version 79.0.3945.117 (Official Build) (64-bit)
  • Library Version: 1.1.4

I'm going to open a PR:

  • yes
  • no

Description:
in developing an extension which uses the native messaging api you need to cross development with the native/host app. im using concurrently to get nodemon and webpack-extension-reloader running together. the issue is the extension needs to be reloaded after an update to the native app. is there a way i can trigger webpack-extension-reloader to reload from outside its scope? i know there probably isnt anything built in but maybe you have an idea about how i can do it otherwise?

Can the host of the WS server be configurable?

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Linux (running the server)/Windows (running the browser)
  • Browser: Chrome
  • Library Version: 1.1.4

I'm going to open a PR:

  • yes
  • no

Description:
The port on which the server is listening is configurable. But the host is hardcoded as "localhost"
This is a problem in a configuration where the dev environment and the build runtime environment is on one machine while the browser where the extension is being loaded is on another marchine.

The extension reloader is not able to reach ws://localhost:port since the server is listening on another machine.

Can the host be a configuration parameter just like the port ?

Setup difficulties / README

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Windows 10 / Subsystem Linux
  • Browser: Firefox 74
  • Library Version: 1.1.4

I'm going to open a PR:

  • yes
  • no

Description:
I am really stoked to see this package, as developing extensions sure is unnecessary difficult.
However, I am having some trouble setting this up following the README.
I've added this to my webpack config

plugins: [
     new ExtensionReloader({
       port: 9090,
       reloadPage: true,
      entries: {
        contentScript: 'content_script',
         extensionPage: 'popup'
       }
     })

, am running webpack with NODE_ENV=development webpack --watch --mode=development
and loading the extension in Firefox by selecting the manifest in the webpack-generated dist-folder.
However, although webpack properly reloads on file change, the extension does not. I still have to press the "reload extension"-button in Firefox about:debugging to get the update.

Am I doing something wrong?

WebSocket connection error

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Ubuntu 18
  • Browser: Chrome 79
  • Library Version: 1.1.4

I'm going to open a PR:

  • yes
  • no (well, not until we figure out the issue)

Description:
I am getting the following repeated error in the background page from what I assume is my background page trying to connect to webpack-extension-reloader.

WebSocket connection to 'ws://localhost:9090/' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR

I have reproduced it using the sample from this repo here: https://github.com/craigsketchley/webpack-extension-reloader-sample

Is anyone else getting this issue?

Unable to find background.js when placed in subfolder

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Ubuntu 19.10
  • Browser: Chrome
  • Library Version: v1.1.4

I'm going to open a PR:

  • yes
  • no

Description:
Hi, this is either a bug or a question. I created an example project to demonstrate the issue:

https://github.com/rhaksw/test-extension

Running yarn && yarn start in that project generates the following error:

Background script webpack entry not found/match the provided on 'manifest.json' or 'entry.background' option of the plugin

Is this a bug, or is something wrong with my setup? #43 was a similar issue and I didn't find the solution yet. Thanks!

Is it possible to reload when manifest.json changes?

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Ubuntu 19.04
  • Browser: Chrome
  • Library Version: v1.1.1

I'm going to open a PR:

  • yes
  • no

Description:

Would it be possible to make it so that changes to manifest.json also cause a reload? I noticed that it does not reload when I only make changes to the manifest. If I make changes to the manifest and then some other code, everything updates and the new manifest's changes are incorporated.

This package is great. Thank you for making it!

By the way, in case anyone finds it useful, I made an enhancement to my workflow as part of another extension project that allows manifest.json to be variable, for example including a http://localhost/* permission conditionally when developing extensions alongside a website. And, since webpack-extension-reloader requires manifest.json to exist before running webpack, I broke out the manifest build into a new step that runs before the rest of the build.

Repeating socket disconnected error when webpack process killed

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: macOS
  • Browser: Chrome
  • Library Version: v1.1.0

I'm going to open a PR:

  • yes
  • no

Description:
Awesome plugin! Thanks for writing it.
Seems like when the webpack (v4) in development+watch mode process gets killed the socket is not being closed causing the extension's background script to keep throwing errors trying to connect. It doesn't stop trying until webpack is ran again and the socket is available.
Here's a link to where it happens in the code.

image

  • I marked that I'm not going to open a PR but I'd be happy to work on it when I have some time if you can't.

An in-range update of style-loader is breaking the build 🚨

The devDependency style-loader was updated from 1.0.1 to 1.0.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

style-loader is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • build-and-test: null
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.

Release Notes for v1.0.2

1.0.2 (2019-12-17)

Bug Fixes

Commits

The new version differs by 4 commits.

  • 7768fce chore(release): 1.0.2
  • dcbfadb fix: support ES module syntax (#435)
  • d515edc chore(deps): update (#434)
  • 4c1e3f3 docs: fixed typo 'doom' to 'DOM' in README.md (#432)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Is this work in options_page extension?

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: MacOs
  • Browser: Chrome
  • Library Version: 1.1.4

I'm going to open a PR:

  • yes
  • no

Description:
I run Chrome extension options_page (config in manifes ) in new tab but it not reload until I press refresh button on browser ?

In manifest.json
"options_page": "options.html",

In options.html
<script src="options.js"></script>

Please visit my sample and help me why it dont work
https://github.com/NgKhanh/chrome-extension-boilerplate

This is what worked for me. My working example inside.

This plugin is going to save me so much time. Many thanks.

But it took me longer than it should have to understand the readme guide. There were like 3 code samples, each doing something a little different, and it got me way too confused.

So here's my working example for posterity that I've saved in my personal notebook:

  • npm install webpack-extension-reloader --save-dev
  • Update webpack.config.js so it looks like this:
const ExtensionReloader = require('webpack-extension-reloader’)
const CopyPlugin = require('copy-webpack-plugin')

module.exports = {
  mode: 'development',
  watch: true,
  entry: {
    index: './src/index.js',
    background: './src/background.js',
  },
  output: {
    path: path.resolve(__dirname, 'extension'),
    filename: '[name].js',
  },
  plugins: [
    new ExtensionReloader({
      entries: {
        contentScript: 'index',
        background: 'background’, // required even if empty
      }
    }),
    new CopyPlugin([
      { from: './src/manifest.json' }
    ]),
  ]
}

Failed to load extension on server reconnect/restart

Type:

  • bug

Environment:

  • OS: MacOS
  • Browser: Chrome
  • Library Version: v1.1.1

I'm going to open a PR:

  • yes

Description:

Problem:

  1. After stopping the server, the background script keeps trying to reconnect to the server
  2. When starting the server again, webpack-extension-reloader starts listening for connections, but the extension is not finished building and the outputDir has been deleted and does not exist yet.
  3. The extension tries to reload itself, but it doesn't find the files in the disk
  4. The extension errors, and cannot be reloaded. It has to be removed from chrome and re-added

Possible solutions:
a) Start webpack-extension-reloader only after the build is complete and the files are written to the outputDir
b) Stop reloading the extension on reconnect, and wait for a reload signal from the server, when the files are built and written to disk.

image

npx Invalid or unexpected token

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: macOS Mojave
  • Browser: /
  • Library Version: Latest

I'm going to open a PR:

  • yes
  • no

Description:
When running npx webpack-extension-reloader I get: Invalid or unexpected token

An in-range update of copy-webpack-plugin is breaking the build 🚨

The devDependency copy-webpack-plugin was updated from 5.1.0 to 5.1.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

copy-webpack-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

Release Notes for v5.1.1

5.1.1 (2019-12-12)

Bug Fixes

Commits

The new version differs by 2 commits.

  • 96e2315 chore(release): 5.1.1
  • 3b79595 fix: allow to setup empty array (#425)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of babel-loader is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency babel-loader was updated from 8.0.6 to 8.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

babel-loader is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

Release Notes for 8.1.0
Commits

The new version differs by 18 commits.

  • 3ff9926 8.1.0
  • 0817bb6 Bump deps for audit (#834)
  • ecb2b02 Bump acorn from 6.3.0 to 6.4.1 (#828)
  • 13a8238 feat: expose webpack target via babel caller (#826)
  • b568420 Merge pull request #814 from nicolo-ribaudo/tla
  • 1c35731 Update src/injectCaller.js
  • 5f55638 Add schema validation (#822)
  • 8b47312 Merge pull request #821 from PatNeedham/docs/contributing-typo
  • a967311 docs(contributing): fix typo
  • 758d4b5 docs(readme): fix typo (#818)
  • 8a0a25a Add supportsTopLevelAwait to caller
  • 15df92f chore: Do not run node 6 in appveyor
  • 26d1676 chore: Upgrade more dev dependencies
  • 26aa687 chore: Update some dev dependencies
  • a961168 Bump eslint-utils from 1.3.1 to 1.4.2 (#806)

There are 18 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of css-loader is breaking the build 🚨

The devDependency css-loader was updated from 3.3.0 to 3.3.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

css-loader is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

Release Notes for v3.3.1

3.3.1 (2019-12-12)

Bug Fixes

  • better handling url functions and an url in @import at-rules
  • reduce count of require (#1014) (e091d27)
Commits

The new version differs by 10 commits.

  • cbca64d chore(release): 3.3.1
  • 3b12c87 refactor: code (#1017)
  • c80c39f fix: handling urls in @import (#1016)
  • 30a9269 fix: handling escaped urls (#1015)
  • e091d27 fix: reduce count of require (#1014)
  • 60c65e0 fix: characters as URL escapes in url (#1013)
  • 8e8ab18 fix: handling string urls with backslash and newline (#1012)
  • b59c4f2 test: special characters in file name (#1011)
  • b119d02 fix: handling unquoted syntax url with escaped characters (#1010)
  • 880344b refactor: code (#1009)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Does WER plugin enable content-script hot reload?

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Win
  • Library Version:

I'm going to open a PR:

  • yes
  • no

Description:
[I stumbled upon Kocal Vue extension boilerplate which is using webpack-chrome-extension-reloader plugin, but they say that it only supports hot reloading module for background scripts.

When I read the documentation for WER plugin, I have an impression that this plugin does support Hot Module Reloading for content-scripts too.

I tested the boilerplate with WCER plugin installed, and indeed, it seems that plugin only reloads background script entries. Unfortunately, for the content script changes, I have to reload both - extension and browser tab.

Could it be that the boilerplate mentioned above is not set up correctly and therefore not supporting the HRM for content scripts? Or am I missing something from your docs? ]

Unable to develop webpack-extension-reloader on Windows

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Windows
  • Browser: N/A
  • Library Version: 1.1.1

I'm going to open a PR:

  • yes
  • no

Description:
The npm scripts commands NODE_ENV setting is incompatible with Windows. We need to use cross-env easily allow non-Unix based devs to modify webpack extension reloader.

An in-range update of webpack-bundle-analyzer is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency webpack-bundle-analyzer was updated from 3.6.0 to 3.6.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack-bundle-analyzer is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

Commits

The new version differs by 17 commits.

  • 660dba6 v3.6.1
  • 387d7f9 Merge pull request #339 from webpack-contrib/update-some-deps
  • e90b3b1 Downgrade terser-webpack-plugin because v2 requires at least Node v8.9
  • 45ffbf9 Update some dependencies to get rid of vulnerability warnings
  • dd4a03a Merge pull request #328 from pustovalov/node-ci
  • f2f7fda Add Node 12 to CI
  • 7cefb58 Merge pull request #314 from mhxbe/bugfix/page-title-hours-minutes
  • 2596783 Consolidate changelog whitespace
  • 3faca9d Merge branch 'master' into bugfix/page-title-hours-minutes
  • f614bd1 Update CHANGELOG.md
  • 4b58fae Revert .padStart to .slice since padStart is not supported in Node v6
  • c95df99 Fix changelog missing v3.6.0 section
  • f04ab3e Use .padStart(2,0) to prefix one-digit numbers with zero
  • 5219462 Merge branch 'bugfix/page-title-hours-minutes' of github.com:mhxbe/webpack-bundle-analyzer into bugfix/page-title-hours-minutes
  • 27b2de0 Use .slice() in favor of soon to be deprecated .substr()

There are 17 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Background scripts required?

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Windows 10 / Subsystem Linux
  • Browser: Firefox
  • Library Version:

I'm going to open a PR:

  • yes
  • no

Description:
I saw this one in the "contribution"-section, and was wondering why a background script is needed?

Note: You must have both background and content scripts for this plugin to work, and they must be specified in separate entry chunks in your webpack config.

Is it that abnormal to build content-scripts only?

I did encounter an error indicating what the statement above when adding the ExtensionReloader with a manifest without background.

Auto identify background and content-scripts

Type:

  • bug
  • feature
  • enhancement
  • question

I'm going to open a PR:

  • yes
  • no

Description:
Currently the plugin requires the background and content-script entry names from webpack. But is possible to gather this information by cross checking it on "entry" in webpack config and manifest.json information.

This will simplify the usage of the plugin.

syntax bug in 1.1.3

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Linux KDE Neon
  • Browser: Firefox Developer 71.0b9 (64-bit)
  • Library Version: webpack-extension-reloader: 1.1.3

I'm going to open a PR:

  • yes
  • no

Description:
latest update produces an error on run:

image

this is the code in question with the error in /dist:

//# sourceMappingURL=browser-polyfill.js.map
"";
}).bind(injectionContext)();
var browser = injectionContext.browser;
var signals = JSON.parse("{"SIGN_CHANGE":"SIGN_CHANGE","SIGN_RELOAD":"SIGN_RELOAD","SIGN_RELOADED":"SIGN_RELOADED","SIGN_LOG":"SIGN_LOG","SIGN_CONNECT":"SIGN_CONNECT"}");
var config = JSON.parse("{"RECONNECT_INTERVAL":2000,"SOCKET_ERR_CODE_REF":"https://tools.ietf.org/html/rfc6455#section-7.4.1"}");
var reloadPage = "true" === "true";
var wsHost = "ws://localhost:9090";

not sure if this is a conflict with webextension-polyfill? reverting back to 1.1.2 works fine.

An in-range update of babel7 is breaking the build 🚨

There have been updates to the babel7 monorepo:

    • The devDependency @babel/core was updated from 7.7.5 to 7.7.7.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • build-and-test: null
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

error when background is a page rather than script

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: KDE Neon
  • Browser: Chrome Version 76.0.3809.100 (Official Build) (64-bit)
  • Library Version: 1.1.0

I'm going to open a PR:

  • yes
  • no

Description:
i think there is an error when pointing to the manifest and using background as a page and not a script like so:

new ExtensionReloader({
        manifest: path.resolve(__dirname, "src/manifest.json"),
      }),
	"background": {
		"page": "background/background.html"
	},

ERROR TypeError: Cannot read property 'some' of undefined

An in-range update of @types/sinon is breaking the build 🚨

The devDependency @types/sinon was updated from 7.5.1 to 7.5.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

content-scripts breaks the plugin

Type:

  • [* ] bug
  • feature
  • enhancement
  • question

Environment:

  • OS: windows 10
  • Browser: chrome 80 dev
  • Library Version: 1.1.4

I'm going to open a PR:

  • yes
  • no

Description:
When manifest.json contains following content-scripts:
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": [
"content/css/content.css"
],
"run_at": "document_start",
"all_frames": true
}
],

build command works, but watch:dev failed with following error:

[email protected] build:dev
cross-env NODE_ENV=development webpack --hide-modules "--watch"

\node_modules\lodash\lodash.js:639
result[index] = iteratee(array[index], index, array);
^
TypeError: Cannot read property 'map' of undefined
at \node_modules\webpack-extension-reloader\dist\webpack:\src\utils\manifest.ts:45:14
at Array.map ()
at \node_modules\webpack-extension-reloader\dist\webpack:\src\utils\manifest.ts:43:25
at arrayMap (\node_modules\lodash\lodash.js:639:23)
at map (\node_modules\lodash\lodash.js:9554:14)
at Function.flatMapDeep (\node_modules\lodash\lodash.js:9281:26)
at Object.extractEntries (\node_modules\webpack-extension-reloader\dist\webpack:\src\utils\manifest.ts:42:7)
at ExtensionReloaderImpl._registerPlugin (\node_modules\webpack-extension-reloader\dist\webpack:\src\ExtensionReloader.ts:84:9)
at ExtensionReloaderImpl.apply (\node_modules\webpack-extension-reloader\dist\webpack:\src\ExtensionReloader.ts:121:12)
at webpack (\node_modules\webpack\lib\webpack.js:51:13)
at processOptions (\node_modules\webpack-cli\bin\cli.js:272:16)
at yargs.parse (\node_modules\webpack-cli\bin\cli.js:364:3)
at Object.parse (\node_modules\yargs\yargs.js:567:18)
at \node_modules\webpack-cli\bin\cli.js:49:8
at Object. (\node_modules\webpack-cli\bin\cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (\node_modules\webpack\bin\webpack.js:156:2)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

The extensionPage option only works when the reloadPage option is set to true

Type:

  • bug

Environment:

  • OS: MacOS
  • Browser: 78.0.3904.97
  • Library Version: 1.1.1

I'm going to open a PR:

  • yes

Description:
The extensionPage option only works when the reloadPage option is set to true.
With reloadPage: false it doesn't do anything. However this option should be independent from the extensionPage page option. The reloadPage option should only apply to content scripts.

Related to #37

[Question] Can this support hot reloading a Popup's JS bundle (defined by another entry))

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS:
  • Browser:
  • Library Version:

I'm going to open a PR:

  • yes
  • no
  • maybe

Description:
Is there a reason that this package can't support a popup.html JS bundle which is linked and a separate entry point to background and content-script ? I can achieve this with webpack-dev-server but would prefer to use 1 development server if possible.

Thanks for your work on this package and if I can help support this happening then I will be happy to :)

issue with code running instantly

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: KDE Neon
  • Browser: Chrome Version 76.0.3809.100 (Official Build) (64-bit)
  • Library Version: 1.1.0

I'm going to open a PR:

  • yes
  • no

Description:
not sure what to call this but there is this weird issue where code gets run instantly on reload skipping over debugger calls and in my case leaves the sent message as undefined. this doesnt happen if regularly built and loaded into the browser. ill expound:
in my case i have the content script sending a simple message:

const hostString1 = "a string";
browser.runtime.sendMessage({ type: "hostname", hostname: hostString1 });

and listening for said message in the background:

browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
  console.log(`background.js: ${message.hostname}`);
});

if i reload the page to trigger the content script i get:

background.js: undefined
background.js: a string

when i stick a debugger at the top of background.js i still get background.js: undefined instantly. also, the message seem to come through properly.

An in-range update of @types/webpack is breaking the build 🚨

The devDependency @types/webpack was updated from 4.32.2 to 4.39.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of webpack is breaking the build 🚨

The devDependency webpack was updated from 4.35.3 to 4.36.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v4.36.0

Features

  • SourceMapDevToolPlugin append option now supports the default placeholders in addition to [url]
  • Arrays in resolve and parser options (Rule and Loader API) support backreferences with "..." when overriding options.
Commits

The new version differs by 42 commits.

  • 95d21bb 4.36.0
  • aa1216c Merge pull request #9422 from webpack/feature/dot-dot-dot-merge
  • b3ec775 improve merging of resolve and parsing options
  • 53a5ae2 Merge pull request #9419 from vankop/remove-valid-jsdoc-rule
  • ab75240 Merge pull request #9413 from webpack/dependabot/npm_and_yarn/ajv-6.10.2
  • 0bdabf4 Merge pull request #9418 from webpack/dependabot/npm_and_yarn/eslint-plugin-jsdoc-15.5.2
  • f207cdc remove valid jsdoc rule in favour of eslint-plugin-jsdoc
  • 31333a6 chore(deps-dev): bump eslint-plugin-jsdoc from 15.3.9 to 15.5.2
  • 036adf0 Merge pull request #9417 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.8.0
  • 37d4480 Merge pull request #9411 from webpack/dependabot/npm_and_yarn/simple-git-1.121.0
  • ce2a183 chore(deps-dev): bump eslint-plugin-jest from 22.7.2 to 22.8.0
  • 0beeb7e Merge pull request #9391 from vankop/create-hash-typescript
  • bf1a24a #9391 resolve super call discussion
  • bd7d95b #9391 resolve discussions, AbstractMethodError
  • 4190638 chore(deps): bump ajv from 6.10.1 to 6.10.2

There are 42 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/webpack-sources is breaking the build 🚨

The dependency @types/webpack-sources was updated from 0.1.5 to 0.1.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/webpack-sources is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

[Feature] Possibility to use HMR on content-script

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: macOS
  • Library Version: 1.0.0

I'm going to open a PR:

  • yes
  • no

Description:
Hello,

After reading the README I had a few more questions. If I understand well, this plugin allows reloading the chrome extension from its background script and reloading a page where a content script was injected.

But is it also possible to perform Hot Module Replacement with it?

My use case is the following:

  • A chrome extension which only overrides the "new tab" page.
  • I want to use HMR on this page for development purposes.
  • If I use webpack-dev-server I get HMR but I don't have the chrome extension APIs available.
  • If I use the extension, then it's the opposite!

Any idea on how to achieve this (or if it's even possible...).

Thank you :)

Be aware of extension CSP and modify manifest.json content_security_policy attribute

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS:
  • Browser:
  • Library Version:

I'm going to open a PR:

  • yes
  • no

Description:
Background
I develop an extension with a strict Content Security Policy (specified in the manifest as content_security_policy) that restricts network communication. Of curse, I want my production CSP to restrict WebSocket communication even to localhost. At the same time, I want to use this plugin in development. I don't want to add extra logic to my build scripts and instead, I'd like this plugin to edit manifest when it needs to.

Desired behavior
When the plugin is active, it works seamlessly no matter what CSP was in the source manifest. That is, the plugin automatically relaxes CSP as it needs to.

Current behavior
Connection refused because it is restricted by CSP. E.g., if CSP includes directive connect-src https://*, I get the following error:

Refused to connect to 'ws://localhost:9090/' because it violates the following Content Security Policy directive: "connect-src https://*".

How to fix it
I think the plugin can modify the CSP before it's written to the output to allow communication with WSHost from the script. Note that it's insufficient to just append a directive like connect-src <wsHost> because duplicate directives do not relax earlier directives. The script would need to extract connect-src and/or default-src and append wsHost to them and then assemble the whole CSP back (easily done with reg ex).

Test case
I'll post reduced test case (a tiny extension project) if you are interested in this issue.

Create Parcel version of this plugin

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS:
  • Library Version:

I'm going to open a PR:

  • yes
  • no

Description:
It would be very nice if such a plugin will be created for Parcel. Is there any chance that this will be implemented ?

Reloading open default popup

Type:

  • bug
  • feature
  • enhancement
  • question

Description:
Is there a way to make an open default popup reload on change? Thanks.

Auto reload extension pages (popup)

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS:
  • Browser:
  • Library Version:

I'm going to open a PR:

  • yes
  • no

Description:
I need the plugin to reload extension pages like the popup and not have the entire extension reload if the only entry point to change is in an extension page.

I don't think there is going to be a reliable way to auto-detect extension page entry points from the manifest so it will only be supported through entries.extensionPage or the CLI.

Unable to find manifest.json on subdirectories

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Ubuntu 19.04
  • Browser: Chrome
  • Library Version: v1.1.1

I'm going to open a PR:

  • yes
  • no

Description:
When using the manifest parameter to ExtensionReloader, this block of code essentially requires that you place your background script in the folder alongside manifest.json. An error occurs if you put your background script in a subfolder such as src/background.js.

The toRemove variable seems setup to expect a value like .js, but if you have a subfolder, it can end up as ./src/.js. A fix might be to break the toRemove variable into two parts, toRemove_prefix and toRemove_suffix, resulting in ./src/ and .js.

As I look at this more, I wonder why content scripts, background scripts and extension pages need to be specified separately for webpack-extension-reloader.

An in-range update of webpack is breaking the build 🚨

The devDependency webpack was updated from 4.41.2 to 4.41.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

Release Notes for v4.41.3

Security

  • force upgrade terser-webpack-plugin dependency for security fix (not affecting webpack)

Funding

  • add npm funding field to package.json
Commits

The new version differs by 5 commits.

  • df9f3eb 4.41.3
  • fe71d68 Merge pull request #10010 from webpack/funding
  • b396d96 Merge pull request #10123 from pustovalov/webpack-4-serialize
  • 29b2bdd Update terser-webpack-plugin to ^1.4.3
  • bedb566 chore: funding field

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Hot reload devtools extension

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: any
  • Browser: chrome
  • Library Version:

I'm going to open a PR:

  • yes
  • no

Description:
I’m currently building a chrome devtools extension (https://developer.chrome.com/extensions/devtools). Unfortunately this plugin doesn’t automatically reload the custom devtools page, although it does reload the background script.
What would it take to extend your extension, in order to hot reload devtools extensions as well?

An in-range update of autoprefixer is breaking the build 🚨

The devDependency autoprefixer was updated from 9.7.3 to 9.7.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

autoprefixer is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • build-and-test: null
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.

Release Notes for 9.7.4
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Loosing connection when building linked package

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Windows
  • Browser: Chrome
  • Library Version: = 1.1.0

I'm going to open a PR:

  • yes
  • no

Description:
I've got an extension that uses npm link to another package. The first time I npm run build my linked package, webpack properly watches and rebuilds, and the webpack-extension-reloader also receives the message and reloads the extension and refreshes the browser pages. But it only works once. After that the webpack-extension-reloader seems to have lost its connection. Although if I stop the extension, I do see that the extension reloader polls to reconnect.

Could not establish connection. Receiving end does not exist.

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Osx
  • Browser: Chrome 76.0.3809.100
  • Library Version: 1.1.0

I'm going to open a PR:

  • yes
  • no

Description:
I'm getting an error thrown in the console (index):1 Uncaught (in promise) at content.js:1239
and the error message has the property "Could not establish connection. Receiving end does not exist."

I've have tried with Webpack set at these versions and they both give the same result:
"webpack": "^4.26.1",
"webpack-cli": "^3.1.2"
Also:
"webpack": "^4.39.1",
"webpack-cli": "^3.3.6"

When I fire up Webpack I see [ Starting the Hot Extension Reload Server... ] printed to the bash console and [ WCER: Connected to Chrome Extension Hot Reloader ] printed to Chromes dev console.

An in-range update of @types/chai is breaking the build 🚨

The devDependency @types/chai was updated from 4.2.6 to 4.2.7.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/chai is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • build-and-test: null
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of ws is breaking the build 🚨

The dependency ws was updated from 7.2.0 to 7.2.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ws is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • build-and-test: null
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.

Commits

The new version differs by 7 commits.

  • 9531cd0 [dist] 7.2.1
  • a4b9e0b [ci] Test on node 13
  • 6df06d9 [minor] Use Infinity if concurrency value is falsy
  • 950e41a [minor] Remove async-limiter dependency
  • 3293284 [minor] Remove unnecessary optimization
  • f06a738 [pkg] Add engines field
  • 289724f [pkg] Add bufferutil and utf-8-validate as peer dependencies (#1626)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of minimist is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The dependency minimist was updated from 1.2.0 to 1.2.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

minimist is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.
  • build-and-test: null

Commits

The new version differs by 5 commits.

  • 29783cd 1.2.1
  • 6be5dae add test
  • ac3fc79 fix bad boolean regexp
  • 4cf45a2 Merge pull request #63 from lydell/dash-dash-docs-fix
  • 5fa440e move the opts['--'] example back where it belongs

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/webpack is breaking the build 🚨

The dependency @types/webpack was updated from 4.41.0 to 4.41.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/webpack is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • build-and-test: null
  • install-audit-lint: There are 1 failures, 0 warnings, and 0 notices.

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Support background script in a subfolder

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: macOS
  • Library Version: 1.0.0

I'm going to open a PR:

  • yes
  • no

Description:
For my project, I output my background script in a subfolder. So my webpack entry looks like:

entry: {
   'scripts/background': './src/background-script/background.ts',
   ...
}

The library fails to find my background script if I set options to:

new ExtensionReloader({
   port: 9090, // Which port use to create the server
   reloadPage: true, // Force the reload of the page also
   entries: { // The entries used for the content/background scripts
      background: 'scripts/background'
   }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.