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
- Host: GitHub
- URL: https://github.com/diegohaz/webpack-sort-chunks
- Owner: diegohaz
- License: mit
- Created: 2017-05-01T03:25:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-26T21:48:13.000Z (almost 8 years ago)
- Last Synced: 2024-10-19T10:05:19.970Z (over 1 year ago)
- Topics: webpack
- Language: JavaScript
- Homepage:
- Size: 143 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# webpack-sort-chunks
[](https://github.com/diegohaz/nod)
[](https://npmjs.org/package/webpack-sort-chunks)
[](https://travis-ci.org/diegohaz/webpack-sort-chunks) [](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)