All Projects â†’ SimplifyJobs â†’ webpack-ext-reloader

SimplifyJobs / webpack-ext-reloader

Licence: MIT License
Add hot reloading to your webpack WebExtension! 🔥

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to webpack-ext-reloader

Webpack Webextension Plugin
Webpack plugin that compiles WebExtension manifest.json files and adds smart auto reload
Stars: ✭ 47 (+51.61%)
Mutual labels:  webpack-plugin, webextension
tinyimg-webpack-plugin
A webpack plugin for compressing image
Stars: ✭ 61 (+96.77%)
Mutual labels:  webpack-plugin
deviantART-Filter
A browser extension that allows you to filter DeviantArt by user, keyword, and/or category.
Stars: ✭ 16 (-48.39%)
Mutual labels:  webextension
robotstxt-webpack-plugin
A webpack plugin to generate a robots.txt file
Stars: ✭ 31 (+0%)
Mutual labels:  webpack-plugin
csgo-trader-extension
CSGO Trader Browser Extension to help with CS:GO item trading, marketing and much more
Stars: ✭ 86 (+177.42%)
Mutual labels:  webextension
neutrino-webextension
Neutrino 9 preset for WebExtension/Chrome extension development with hot reload and framework devtools.
Stars: ✭ 31 (+0%)
Mutual labels:  webextension
chunk-progress-webpack-plugin
Provides runtime progress events by replacing default webpack chunk loading with XHR
Stars: ✭ 17 (-45.16%)
Mutual labels:  webpack-plugin
re-style
A user style manager for Firefox 57+ which can load local files and apply UI styles
Stars: ✭ 33 (+6.45%)
Mutual labels:  webextension
protonmail-webextension
Unofficial webextension for ProtonMail
Stars: ✭ 39 (+25.81%)
Mutual labels:  webextension
grammarly-markdown-extension
🖋 Convert Grammarly to Markdown (browser extension)
Stars: ✭ 23 (-25.81%)
Mutual labels:  webextension
dva-typescript-antd-starter-kit
A admin dashboard application demo based on antd by typescript and dva
Stars: ✭ 61 (+96.77%)
Mutual labels:  webpack-plugin
base-href-webpack-plugin
Webpack plugin for inserting base href tag in head block
Stars: ✭ 23 (-25.81%)
Mutual labels:  webpack-plugin
Session-resurrection
Save your browser sessions and restore them any time
Stars: ✭ 36 (+16.13%)
Mutual labels:  webextension
license-info-webpack-plugin
Making a list of package's LICENSE information for webpack
Stars: ✭ 20 (-35.48%)
Mutual labels:  webpack-plugin
prettier-webpack-plugin
Process your Webpack dependencies with Prettier
Stars: ✭ 47 (+51.61%)
Mutual labels:  webpack-plugin
youtube-audio
Disable videos on Youtube saves resource usage (Youtube becomes audio only)
Stars: ✭ 13 (-58.06%)
Mutual labels:  webextension
web-extension-boilerplate
The web extension boilerplate help to set up project quickly using typescript, jest, webpack, githook, prettier and github actions
Stars: ✭ 35 (+12.9%)
Mutual labels:  webextension
drop-feeds
Drop Feeds is a Sage / Sage++ like addon (webextension) for Firefox Quantum
Stars: ✭ 18 (-41.94%)
Mutual labels:  webextension
bundle-inspector-webpack-plugin
Bundle Inspector | Analysis Tool for Webpack
Stars: ✭ 19 (-38.71%)
Mutual labels:  webpack-plugin
mute-sites-by-default
WebExtension that mutes all sites by default and remembers unmuted sites
Stars: ✭ 19 (-38.71%)
Mutual labels:  webextension

Webpack Extension Reloader

A Webpack plugin to automatically reload browser extensions during development.

npm version Test Status Known Vulnerabilities NPM Downloads

Installing

npm

npm install webpack-ext-reloader --save-dev

yarn

yarn add webpack-ext-reloader --dev

What is this?

This is a webpack plugin that allows you to bring hot reloading functionality to WebExtensions, essentially webpack-dev-server, but for (WebExtensions)[https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions].

This is a fork from webpack-extension-reloader, maintained and updated by the team here at Simplify. The goal here is to continue to support the latest version of webpack (webpack-extension-reloader only supports webpack v4) while adding new improvements (i.e. HMR).

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

How to use

Using as a plugin

Add webpack-ext-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 ExtReloader = require('webpack-ext-reloader');

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

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

plugins: [
  new ExtReloader({
    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 ExtReloader({
      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 ExtReloader({
    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-ext-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-ext-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-ext-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 has been forked from rubenspgcavalcante/webpack-extension-reloader, which is licensed under the MIT license. All changes made in this fork have been licensed via the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].