# yyl-concat-webpack-plugin

> ## USAGE

Latest version **1.0.11** (published 2021-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install yyl-concat-webpack-plugin
pnpm add yyl-concat-webpack-plugin
yarn add yyl-concat-webpack-plugin
bun add yyl-concat-webpack-plugin
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2021-04-13 |
| First published | 2019-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 26.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | liudaojie |
| Maintainers | jackness |

## Links

- npm: https://www.npmjs.com/package/yyl-concat-webpack-plugin
- Repository: https://github.com/jackness1208/yyl-concat-webpack-plugin
- Homepage: https://github.com/jackness1208/yyl-concat-webpack-plugin#readme
- Issues: https://github.com/jackness1208/yyl-concat-webpack-plugin/issues
- npm.io page: https://npm.io/package/yyl-concat-webpack-plugin

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [terser](https://npm.io/package/terser.md) ^5.5.1
- [tapable](https://npm.io/package/tapable.md) ^2.2.0
- [yyl-util](https://npm.io/package/yyl-util.md) ^2.3.9
- [concat-with-sourcemaps](https://npm.io/package/concat-with-sourcemaps.md) ^1.1.0
- [yyl-webpack-plugin-base](https://npm.io/package/yyl-webpack-plugin-base.md) ^0.2.2

## Recent versions

- 1.0.11 (latest) — 2021-04-13
- 1.0.10 — 2021-03-06
- 1.0.9 — 2021-03-05
- 1.0.8 — 2021-03-04
- 1.0.7 — 2021-02-04
- 1.0.6 — 2021-02-04
- 1.0.5 — 2021-02-04
- 1.0.4 — 2021-02-03
- 1.0.3 — 2021-02-02
- 1.0.2 — 2021-02-02
- 1.0.1 — 2021-02-02
- 1.0.0 — 2021-02-01
- 0.2.10 — 2020-03-09
- 0.2.9 — 2020-03-05
- 0.2.8 — 2020-02-22
- … 11 more at https://npm.io/package/yyl-concat-webpack-plugin/versions

## README

# yyl-concat-webpack-plugin

## USAGE

### plugin

```javascript
const YylConcatWebpackPlugin = require('yyl-concat-webpack-plugin')

const wConfig = {
  plugins: [
    new YylConcatWebpackPlugin({
      fileMap: {
        'dist/assets/js/vendors.js': ['src/js/a.js', 'src/js/b.js']
      },
      uglify: false,
      logBasePath: process.cwd(),
      fileName: '[name]-[hash:8].[ext]'
    })
  ]
}
```

### hooks

#### example

```javascript
let YylCopyWebpackPlugin
try {
  YylCopyWebpackPlugin = require('yyl-copy-webpack-plugin')
} catch (er) {
  if (!(er instanceof Error) || er.code !== 'MODULE_NOT_FOUND') {
    printError(er)
  }
}
class YourPlugin {
  render(src, source) {
    return source
  }
  apply(compiler) {
    if (YylCopyWebpackPlugin) {
      compiler.hooks.compilation.tap(YylCopyWebpackPlugin.getName(), (compilation) => {
        // + beforeCopy
        YylCopyWebpackPlugin.getHooks(compilation).beforeCopy.tapAsync(PLUGIN_NAME, (obj, done) => {
          obj.source = this.render({
            src: obj.src,
            source: obj.source
          })
          done(null, obj)
        })
        // - beforeCopy

        //+ afterCopy
        YylCopyWebpackPlugin.getHooks(compilation).afterCopy.tapAsync(PLUGIN_NAME, (obj, done) => {
          obj.source = this.render({
            src: obj.src,
            source: obj.source
          })
          done(null, obj)
        })
        //- afterCopy
      })
    }
  }
}
```

## hooks

```javascript
let YylConcatWebpackPlugin
try {
  YylConcatWebpackPlugin = require('yyl-concat-webpack-plugin')
} catch (e) {
  if (!(e instanceof Error) || e.code !== 'MODULE_NOT_FOUND') {
    throw e
  }
}

const PLUGIN_NAME = 'your_plugin'
class ExtPlugin {
  apply(compiler) {
    const IPlugin = YylConcatWebpackPlugin
    if (IPlugin) {
      compiler.hooks.compilation.tap(IPlugin.getName(), (compilation) => {
        IPlugin.getHooks(compilation).beforeConcat.tapAsync(PLUGIN_NAME, (obj, done) => {
          console.log('hooks.beforeConcat(obj, done)', 'obj:', obj)
          done(null, obj)
        })
        IPlugin.getHooks(compilation).afterConcat.tapAsync(PLUGIN_NAME, (obj, done) => {
          console.log('hooks.afterConcat(obj, done)', 'obj:', obj)
          done(null, obj)
        })
      })
    }
  }
}
```

## ts

[文档](./docs/modules.md)

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