Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/king-prawns/webpack-tree-dependency
A Webpack plugin that creates a dependency tree
https://github.com/king-prawns/webpack-tree-dependency
dependency-tree plugin webpack
Last synced: about 2 months ago
JSON representation
A Webpack plugin that creates a dependency tree
- Host: GitHub
- URL: https://github.com/king-prawns/webpack-tree-dependency
- Owner: king-prawns
- License: mit
- Created: 2018-02-11T16:42:27.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-18T09:01:53.000Z (almost 7 years ago)
- Last Synced: 2024-11-05T02:17:42.686Z (about 2 months ago)
- Topics: dependency-tree, plugin, webpack
- Language: JavaScript
- Size: 17.6 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Webpack dependency tree
[![NPM](https://nodei.co/npm/webpack-tree-dependency.png?compact=true)](https://nodei.co/npm/webpack-tree-dependency/)
This a [webpack](https://webpack.js.org/) plugin that creates a dependency tree.
## Install
```bash
npm install --save-dev webpack-tree-dependency
```## Usage
**webpack.dev.config.js**
```js
var TreeWebpackPlugin = require('webpack-tree-dependency');module.exports = {
plugins: [new TreeWebpackPlugin()]
};
```After starting the dev server you will be able to find the output file at:
`localhost:port/filename.html` (or .json)
## Options
|Name|Type|Default|Description|
|:--:|:--:|:-----:|:----------|
|**`directory`**|`{String}`| `'src'`|relative path to src folder|
|**`extensions`**|`{Array}`|`['js']`|Files to include|
|**`filename`**|`{String}`|`'tree'`|output filename|
|**`emitHtml`**|`{Boolean}`|`true`|emit HTML or JSON|```js
new TreeWebpackPlugin({
directory: 'path/to/src',
extensions: ['js', 'html'],
filename: 'map',
emitHtml: true
})
```## Example
**.json**
```json
{
"type": "js",
"path": "root",
"name": "main",
"children": [
{
"type": "js",
"path": "/components/comp-one",
"name": "index",
"children": [
{
"type": "js",
"path": "/components/comp-one/libs",
"name": "awesome-lib",
"children": [],
"recursive": true
},
{
"type": "html",
"path": "/components/comp-one",
"name": "template",
"children": [],
"recursive": false
},
{}
],
"recursive": false
},
{
"type": "js",
"path": "/components/comp-two",
"name": "index",
"children": [],
"recursive": false
}
],
"recursive": false
}
```