# dependency-rules-webpack-plugin

> Enforces rules for dependencies between application layers.

Latest version **0.1.1** (published 2018-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install dependency-rules-webpack-plugin
pnpm add dependency-rules-webpack-plugin
yarn add dependency-rules-webpack-plugin
bun add dependency-rules-webpack-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2018-03-18 |
| First published | 2018-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christian Blos |
| Maintainers | cblos |

## Links

- npm: https://www.npmjs.com/package/dependency-rules-webpack-plugin
- Repository: https://github.com/christianblos/dependency-rules-webpack-plugin
- npm.io page: https://npm.io/package/dependency-rules-webpack-plugin

## Recent versions

- 0.1.1 (latest) — 2018-03-18
- 0.1.0 — 2018-03-17

## README

# Purpose

This webpack plugin can be used to enforce layers in your application.
This is done by defining import rules like "Layer A is not allowed to access layer B".


# Installation

- With npm: `npm install --save-dev dependency-rules-webpack-plugin`
- Or with yarn: `yarn add --dev dependency-rules-webpack-plugin`

# Usage

Add Plugin to your webpack config

```js
const CheckDependencyRulesPlugin = require('dependency-rules-webpack-plugin');

module.exports = {
    //...

    plugins: [
        new CheckDependencyRulesPlugin({
            rules: [
                // files in src/domain/ may not import files from src/app/
                // and files in src/domain/ may not import from the react library
                {
                    module: '/src/domain/',
                    deny: ['/src/app/', '/node_modules/react/']
                },
                // files in src/components/ may not import files from src/app/
                {
                    module: '/src/components/',
                    deny: ['/src/app/']
                }
            ]
        })
    ],
    
    //...
};
```

---
_Source: https://npm.io/package/dependency-rules-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
