An open API service indexing awesome lists of open source software.

https://github.com/diegohaz/webpack-sort-chunks

Sorts webpack chunks by dependency
https://github.com/diegohaz/webpack-sort-chunks

webpack

Last synced: about 1 year ago
JSON representation

Sorts webpack chunks by dependency

Awesome Lists containing this project

README

          

# webpack-sort-chunks

[![Generated with nod](https://img.shields.io/badge/generator-nod-2196F3.svg?style=flat-square)](https://github.com/diegohaz/nod)
[![NPM version](https://img.shields.io/npm/v/webpack-sort-chunks.svg?style=flat-square)](https://npmjs.org/package/webpack-sort-chunks)
[![Build Status](https://img.shields.io/travis/diegohaz/webpack-sort-chunks/master.svg?style=flat-square)](https://travis-ci.org/diegohaz/webpack-sort-chunks) [![Coverage Status](https://img.shields.io/codecov/c/github/diegohaz/webpack-sort-chunks/master.svg?style=flat-square)](https://codecov.io/gh/diegohaz/webpack-sort-chunks/branch/master)

Sorts webpack chunks by dependency

> The source code here is vendored from [html-webpack-plugin/lib/chunksorter.js](https://github.com/jantimon/html-webpack-plugin/blob/master/lib/chunksorter.js)

## Install

$ npm install --save webpack-sort-chunks

## Usage

```js
import sortChunks from 'webpack-sort-chunks'

const sortedChunks = sortChunks(stats.chunks)

// If you hold on to the Webpack compilation, pass it as the second argument
// It will be faster in Webpack >= v4
const sortedChunks = sortChunks(stats.chunks, compilation)
```

## API

#### Table of Contents

- [Compilation](#compilation)
- [Properties](#properties)
- [sortChunks](#sortchunks)
- [Parameters](#parameters)

### Compilation

Type: {chunkGroups: {}}

#### Properties

- `chunkGroups` **{}**

### sortChunks

#### Parameters

- `chunks` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<Chunk>**
- `compilation` **[Compilation](#compilation)**

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<Chunk>**

## License

MIT © [Diego Haz](https://github.com/diegohaz)