@cgamesplay/webpack-query
CLI for inspecting webpack bundles
Last updated 2 years ago by cgamesplay .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cgamesplay/webpack-query 
SYNC missed versions from official npm registry.

webpack-query

A CLI tool that allows you to ask questions about your webpack bundle.

Installation

  1. Install the software:
yarn add @cgamesplay/webpack-query
  1. Set up webpack to save the stats to a well-known location using something like stats-webpack-plugin. Make sure that source is included in the output stats.

  2. Monkey-patch node_modules/webpack/lib/Stats.js

if (showSource && module._source) {
    // Old version:
	// obj.source = module._source.source();
    // New version:
    const sourceAndMap = module._source.sourceAndMap();
    obj.source = sourceAndMap.source;
    obj.sourceMap = sourceAndMap.map;
}
  1. Add an alias to your package.json to make your life easier.
"scripts": {
    "wq": "webpack-query --file path/to/stats.json",
}

Usage

Once you have that alias set up, make sure to build your webpack bundle so that the stats file is available. Then you can use the alias you created to run queries.

webpack
yarn wq dump

Examples

Where is this module imported from?

$ yarn wq list-references ./example/src/module.js
example/src/index.js:1:import { sayHello } from "./module";

Operations

dump

Output the raw webpack stats file. Potentially useful for debugging.

find-module

Given a string, try to resolve it to a specific module and then output the resolved module's identifier.

list-references

List all places in where the named module is imported.

Current Tags

  • 0.0.0-alpha.1                                ...           latest (2 years ago)

1 Versions

  • 0.0.0-alpha.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (5)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |