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

assets-manifest-plugin

v0.0.1

Published

A webpack plugin for entry assets manifest

Downloads

3

Readme

assets-manifest-plugin

A webpack plugin for entry assets manifest. 一个生成入口资源清单的webpack插件

Travis (.org) branch npm GitHub

安装

npm i -D assets-manifest-plugin

# or

yarn add -D assets-manifest-plugin

配置

webpack.config.js

const AssetsManifestPlugin = require('assets-manifest-plugin');

module.exports = {
  // ...
  plugins: [
    new AssetsManifestPlugin({
      filename: 'manifest.js'
    })
  ]
}

打包完成后会输出类似下面的一个文件:

dist/manifest.js

(function(root, factory) {
  if (typeof exports === 'object' && typeof module === 'object') {
    module.exports = factory();
  } else if (typeof define === 'function' && define.amd) {
    define(factory);
  } else if (typeof exports === 'object') {
    exports['ASSETS_MANIFEST'] = factory();
  } else {
    root['ASSETS_MANIFEST'] = factory();
  }
})(this, function() {
  return {
    "main": {
      "js": [
        "js/runtime.6b509e0d.js",
        "js/vendors.066af6ec2.js",
        "js/main.5f10cd1d.js"
      ],
      "css": [
        "css/vendors.ac89822e.css",
        "css/main.5ceab323.css"
      ]
    }
  }
});

配置选项

entries

  • 类型: 'all' | Array<string>
  • 默认: 'all'
  • 描述: 需要生成资源清单的 entry 名,如果设置为 'all',表示生成全部入口资源清单

publicPath

  • 类型: string
  • 默认: null
  • 描述: 在生成的资源清单路径前加的一段路径,如果该项未配置,则会去使用 output.publicPath 的值

filename

  • 类型: string
  • 默认: 'manifest.js'
  • 描述: 生成的入口清单文件名(可以带路径),如果是文件格式是 .js,这会输出一个 UMD 模块文件,如果文件格式是 .json,则输出一个 JSON 文件,推荐生成 UMD 模块

minify

  • 类型: 'auto' | boolean
  • 默认: 'auto'
  • 描述: 是否压缩生成的资源清单文件,如果设置为 'auto',表示根据 optimization.minimize 自动判断是否需要压缩

globalName

  • 类型: string
  • 默认: 'ASSETS_MANIFEST'
  • 描述: 生成 UMD 模块的全局变量名

disabled

  • 类型: boolean
  • 默认: false
  • 描述: 是否禁用插件

shouldEmit

  • 类型: boolean
  • 默认: true
  • 描述: 是否将入口资源清单输出到文件

merge

  • 类型: boolean
  • 默认: false
  • 描述: 是否合并之前的资源清单数据(一般用于多个webpack任务打包时共用一份清单文件)

onEmit

  • 类型: (manifest, mergedManifest) => void
  • 默认: null
  • 描述: 当生成入口资源清单时,执行回调。回调参数是一个包含资源清单的 JSON 对象

devServerAutoPublicPath

  • 类型: boolean
  • 默认: true
  • 描述: 当前是 devServer 模式时,自动设置 publicPath (http://[ip]:[port]/[publicPath])