# hashed-map-webpack-plugin

> Map the filepaths of files output by a webpack compilation from their hashed version to their unhashed version.

Latest version **0.0.13** (published 2017-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install hashed-map-webpack-plugin
pnpm add hashed-map-webpack-plugin
yarn add hashed-map-webpack-plugin
bun add hashed-map-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.0.13 |
| Published | 2017-02-22 |
| First published | 2017-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Anthony Blackshaw |
| Maintainers | getmeuk |
| Keywords | hangar51, webpack |

## Links

- npm: https://www.npmjs.com/package/hashed-map-webpack-plugin
- Repository: git@git.getme.co.uk:getme/hashed-map-webpack-plugin
- npm.io page: https://npm.io/package/hashed-map-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.0.13 (latest) — 2017-02-22
- 0.0.12 — 2017-02-22
- 0.0.11 — 2017-02-22

## README

# hashed-map-webpack-plugin

This plugin maps the filepaths of files output by a webpack compilation from
their hashed version to their unhashed version.


## Example output

```
{
  "/site.js": "https://assets.my-site.com/site.123123.js",
  "/images/edison.jpg": "https://assets.my-site.com/images/edison.123123.jpg",
  "/site.css": "https://assets.my-site.com/site.123123.css"
}
```


## Installation

npm install hashed-map-webpack-plugin --save-dev


## Configuration

In your webpack config include the plug-in. And add it to your config:

```JavaScript
var path = require('path')
var HashedMapPlugin = require('hashed-map-webpack-plugin')

module.exports = {
    plugins: [HashedMapPlugin(), ...]
    output: {
        path: path.join(__dirname, '../www'),
        filename: '[path].[name].[hash].js',
        publicPath: 'https://assets.my-site.com/'
    },
    ...
}
```


## Options

You can pass the following options:

### `exclude`

Regex to match for excluded content.

### `filepath`

Where to save the JSON file output by the plugin.

*Optional.* `static-assets.json` by default.

### `preset`

If you wish you can preset the map to a JavaScript object. This can be useful
for adding in metadata or mappings outside the webpack compilation scope.

> **Note:** Any conflicting filepaths in the preset will be overridden during
compilation.

### `stripHash`

A function used to strip the hash from the filepath. The default function splits
the filename using the dot (`.`) character and rejoins minus the last but one
part, e.g:

```JavaScript
function stripHash(filepath) {
    var parts = filepath.split('.');
    parts.splice(parts.length - 2, 1);
    return parts.join('.');
}

stripHash('/site.123123.js')

> '/site.js'
```

## Testing

To test the plugin run:

`npm test`

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