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 🙏

© 2024 – Pkg Stats / Ryan Hefner

monitor-webpack-plugin

v1.0.3

Published

the monitor for webpack

Downloads

8

Readme

monitor-webpack-plugin

webpack plugin for monitor

帮助开发者在移动端进行调试,本插件是在 monitor 的基础上封装的 webpack 插件,通过 webpack 配置即可自动添加 monitor 调试功能,方便实用。

安装

npm install monitor-webpack-plugin --save-dev

使用

webpack.conf.js 文件配置里增加以下插件配置即可

// 引入插件
var monitorPlugin = require('monitor-webpack-plugin'); 

module.exports = {
    ...

    plugins: [
        new monitorPlugin({
            filter: [],  // 需要过滤的入口文件
            enable: true // 发布代码前记得改回 false
        }),
        ...
    ]
    ...
}

monitor 作为一个调试模块,注定了需要在不同环境配置不同参数,为了避免人为操作失误而影响线上功能,这里建议配置如下:

package.json 文件配置:

scripts: {
    "dev": "webpack -w --debug",
    "prod": "webpack -p"
}

webpack.conf.js 配置:

// 引入插件
var monitorPlugin = require('monitor-webpack-plugin'); 

// 接收运行参数
module.exports = {
    ...

    plugins: [
      new MonitorPlugin({
        enable: true, // 是否引入monitor
        inject:'head',
        paths:['http://monitor.91jinrong.com/monitor.js'], // monitor的代码地址
        content:'var config = { appid: \'xcx-admin\',url: \'http://fdmonitor.91jinrong.com/tr.gif\'};new Monitor(config);' // 初始化参数,appid为项目id,url为提交的服务器域名,详情参考fd monitor文档
      }),
      ...
    ]
    ...
}

这样,在开发的时候运行 npm run dev,发布的时候运行 npm run prod 即可。

webpack-dev-server 的配套用法:

用法其实跟上面一样,只是别忘记在启动脚本的时候增加 --debug 即可。如下:

  // package.json
  "scripts": {
    ...
    "start:dev": "webpack-dev-server --debug",
    ...
  },

例子参考: webpack-demo

直接使用 monitor

当然,有时候一些页面想临时添加 monitor 来调试一下,可以直接使用:

<script src="https://ui.91jinrong.com/monotor/0.1.4/monitor.min.js"></script>
<script>
var config = {
    appid: 'fd-monitor'
}
new Monitor(config);
</script>