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

@plugin-light/webpack-plugin-dispatch-script

v0.0.5

Published

可以将只有分包使用的`javascript/typescript`,移动到相应的分包内。

Downloads

7

Readme

JS 分发

可以将只有分包使用的javascript/typescript,移动到相应的分包内。

如何使用

安装

pnpm add @plugin-light/webpack-plugin-dispatch-script -D

vue.config.js 中添加如下设置:

const { DispatchScriptPlugin } = require('@plugin-light/webpack-plugin-dispatch-script');

module.exports = {
  configureWebpack: {
    plugins: [
      new DispatchScriptPlugin()
    ],
  }
}

参数

export type IDispatchScriptOptions = {
  // 禁止移动的白名单列表
  whiteList?: Array<string>;

  // 是否增加 common/vendor 的引用
  addCommonVendorRequire?: boolean;
};

whiteList 只能是子节点,如果设置了非子节点,那么它引用的所有模块也要一同列举,否则会存在父节点在主包、子节点在分包,引用失败。可以类比成,小兵随便挪地方,将军要走需要连他的手下一起挪走

日志

JS 分发是比较复杂的插件,执行时会在 log 目录下输出一些日志,下面是日志文件的说明。

| 文件名 | 说明 | | ---------------------------------------------- | ---------------------- | | dispatch-script.inner-deps-flatten | 依赖信息,已处理 | | dispatch-script.inner-deps-raw | 依赖信息 | | dispatch-script.inner-deps-to-dispatch-deep | 将要派发的依赖 | | dispatch-script.inner-main-package-pages | 主包页面 | | dispatch-script.raw-module-sources | module.resource 列表 | | dispatch-script.raw-resource-resolve-data-list | 原始引用关系 | | dispatch-script.result-handled-modules | 插件处理的模块 |

文章

uni-app分包优化——JS分发

常见问题

如果遇到下面这样的报错,可以尝试传入 addCommonVendorRequiretrue

TypeError: Cannot read property 'call' of undefined
    at i (runtime.js?t=wechat&s=1718772395771&v=ca775494edc3431fdc68691e2e22246e:3)
    at Object.388b (act-goods-detail-barcode.js:1)
    at i (runtime.js?t=wechat&s=1718772395771&v=ca775494edc3431fdc68691e2e22246e:3)
    at Module.3591 (act-goods-detail-barcode.js:1)
    at i (runtime.js?t=wechat&s=1718772395771&v=ca775494edc3431fdc68691e2e22246e:3)