npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

chrome-manifest-webpack-plugin

v3.0.0

Published

## 一、简介篇

Downloads

90

Readme

chrome-manifest-webpack-plugin

一、简介篇

一个Chrome扩展程序开发工具,让webpack打包支持一下特性

  • 代码热更新 (支持content-script,background,options,popup热更新)。

  • 支持远程代码加载功能(这样,插件发布后,仅需要安装一次客户端,后续更新走服务端网站发布模式即可)。

二、使用篇

普通模式

const ChromeManifestWebpackPlugin = require('chrome-manifest-webpack-plugin');

const isProduction = process.env.NODE_ENV === 'production';
const domain = 'http://localhost:xx';
const hmr = domain + '/__webpack_hmr';

module.exports  = {
  entry: {
    app: [
      isProduction ? null : 'webpack-hot-middleware/client?path=' + hmr + '&timeout=20000&reload=true',
      './packages/pajk-chrome/index.js',
    ].filter(function(v) {return v;}),
  },
  plugins:[
    new ChromeManifestWebpackPlugin({
      manifestPath: 'manifest.json',
      domain: domain,
    })
  ]
}

远程模式

Chrome 扩展程序客户端将会从远程服务器加载扩展脚本的内容,这样后期发布不需要客户端重新更新下载。

步骤:

  • dist目录作为客户端扩展程序,附加到浏览器扩展程序。
  • dist目录下的内容发布成web应用。
const ChromeManifestWebpackPlugin = require('chrome-manifest-webpack-plugin');

const isProduction = process.env.NODE_ENV === 'production';
const domain = 'http://localhost:xx';
const hmr = domain + '/__webpack_hmr';

module.exports  = {
  entry: {
    app: [
      isProduction ? null : 'webpack-hot-middleware/client?path=' + hmr + '&timeout=20000&reload=true',
      './packages/pajk-chrome/index.js',
    ].filter(function(v) {return v;}),
  },
  output: {
    filename: '[name].js',
    chunkFilename: '[name].js',
    // 在生产模式,改成远程加载.
    publicPath: isProduction ? 'https://demo.chrome.extrnsion/' : domain,
  },
  plugins:[
    new ChromeManifestWebpackPlugin({
      manifestPath: 'manifest.json',
      domain: domain,
    })
  ]
}

环境判定

使用了插件,打包后,在content_scripts 中可以通过以下变量来判断当前代码是否运行在content_scripts


if(chrome.env === 'content-script'){
  console.log('运行在content-scripts中');
}