# public-webpack-plugin

> webpack plugin that emits a JSON file with public paths

Latest version **0.1.0** (published 2015-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install public-webpack-plugin
pnpm add public-webpack-plugin
yarn add public-webpack-plugin
bun add public-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.0 |
| Published | 2015-11-06 |
| First published | 2015-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.2 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Sasha Koss |
| Maintainers | kossnocorp |
| Keywords | webpack |

## Links

- npm: https://www.npmjs.com/package/public-webpack-plugin
- Repository: git@github.com:kossnocorp/public-webpack-plugin
- Homepage: https://github.com/kossnocorp/public-webpack-plugin
- Issues: https://github.com/kossnocorp/public-webpack-plugin/issues
- npm.io page: https://npm.io/package/public-webpack-plugin

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-11-06

## README

# PublicWebpackPlugin
[![Build Status](https://travis-ci.org/kossnocorp/public-webpack-plugin.svg?branch=master)](https://travis-ci.org/kossnocorp/public-webpack-plugin)

A companion plugin for [public-loader](https://github.com/kossnocorp/public-loader),
it emits a JSON file with paths to included public files.

It's like [assets-webpack-plugin](https://github.com/sporto/assets-webpack-plugin)
but for static assets.

## Installation

Install [public-loader](https://github.com/kossnocorp/public-loader) and
[file-loader](https://github.com/webpack/file-loader):

```sh
npm install public-loader file-loader --save-dev
```

Install the plugin:

```sh
npm install public-webpack-plugin --save-dev
```

## Example

In a webpack config:

```js
var path = require('path')
var PublicWebpackPlugin = require('public-webpack-plugin')

// ...

var distPath = path.join(process.cwd(), 'dist')

module.exports = {
  // ...

  output: {
    path: distPath,
    publicPath: '/',

    // ...
  },

  plugins: [new PublicWebpackPlugin({
    path: path.join(distPath, 'public.json')
  })]
}
```

In an entry:

```js
require.context('!!public!./assets', true, /.+/)

// ...
```

Run webpack to build entries:

```sh
webpack
```

`cat dist/public.json`:

```json
{
  "/Users/koss/src/date-fns/date-fns.org/ui/static/img/favicon.png": "/e09ef13032827f865ef8004c185277f7.png"
}
```

## License

MIT

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