# replace-resources-plugin

> Copies the source file data to a target file

Latest version **0.0.4** (published 2020-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install replace-resources-plugin
pnpm add replace-resources-plugin
yarn add replace-resources-plugin
bun add replace-resources-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.4 |
| Published | 2020-01-13 |
| First published | 2020-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Egor Skorobogatov |
| Maintainers | oh_hi_npm! |
| Keywords | webpack, plugin, replace, copy, source |

## Links

- npm: https://www.npmjs.com/package/replace-resources-plugin
- Repository: https://github.com/git-decadent/replace-resources-plugin
- Issues: https://github.com/git-decadent/replace-resources-plugin/issues
- npm.io page: https://npm.io/package/replace-resources-plugin

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2020-01-13
- 0.0.3 — 2020-01-10
- 0.0.2 — 2020-01-10
- 0.0.1 — 2020-01-10

## README

# Replace Resources Plugin

[![npm][npm-image]][npm-url]
[![MIT License][mit-license-image]][mit-license-url]

[npm-url]: https://www.npmjs.com/package/replace-resources-plugin
[npm-image]: https://img.shields.io/npm/v/replace-resources-plugin.svg?label=npm%20version
[mit-license-url]: LICENSE
[mit-license-image]: https://camo.githubusercontent.com/d59450139b6d354f15a2252a47b457bb2cc43828/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f7365727665726c6573732e737667

A webpack plugin to copy data from the source file to a target one

## Installation

`npm install --save-dev replace-resources-plugin`

## Usage

Add the plugin to your webpack config. For example:

**webpack.config.js**

```js
const ReplaceResourcesPlugin = require('replace-resource-plugin');

const webpackConfig = {
    plugins: [
        new ReplaceResourcesPlugin(/\.src\.js/, /\.dist\.js/),
    ],
};

module.exports = webpackConfig;
```
## Parameters

The plugin requires two parameters:

```js
new ReplaceResourcesPlugin(sourceRegExp, distRegExp [, options]),
```

Which must be regular expressions and mean to be used to detect a source file of data and a destination file where the data must be copied to.
The destination regular expression is applied firstly if it matches the file name. If this condition is true then the source regular expression is used to find whether there is the file matching it in the current working directory. If the source file is found the data of it is being copied to a destination one.

* **sourceRegExp**: `RegExp`
* **distRegExp**: `RegExp`
* **options**: `Object` - optional
    * **replaceDistFileIfHMR**: `Boolean`, default: `false` - defines if the plugin must process changes that are happening due to [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/) on a destination file. By default changes are happening in the runtime and detected by HMR will be ignored in order to avoid infinite loop of replacmemts between source and destination files.

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