# transform-json-webpack-plugin

> Webpack plugin to generate a JSON asset file

Latest version **0.0.2** (published 2020-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install transform-json-webpack-plugin
pnpm add transform-json-webpack-plugin
yarn add transform-json-webpack-plugin
bun add transform-json-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.2 |
| Published | 2020-11-19 |
| First published | 2018-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10.13.0 |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Code Sphinx |
| Maintainers | codesphinx |
| Keywords | webpack, plugin, json, json-edit, json-transform |

## Links

- npm: https://www.npmjs.com/package/transform-json-webpack-plugin
- Repository: https://github.com/codesphinxx/transform-json-webpack-plugin
- Homepage: https://github.com/codesphinxx/transform-json-webpack-plugin#readme
- Issues: https://github.com/codesphinxx/transform-json-webpack-plugin/issues
- npm.io page: https://npm.io/package/transform-json-webpack-plugin

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.2 (latest) — 2020-11-19
- 0.0.1 — 2018-11-03

## README

# transform-json-webpack-plugin
[![npm][npm]][npm-url]
[![node][node]][node-url]
[![size][size]][size-url]


Webpack plugin to generate a JSON asset file.


## Install

```bash
npm install --save-dev transform-json-webpack-plugin
```

## Options

|Name|Type|Description|
|:--:|:--:|:----------|
|[`filename`](#filename)|`{String}`|Output file name(may include path)|
|[`object`](#object)|`{Object}`|Object to add to output file or the properties you wish to modify|
|[`source`](#source)|`{String}`|Path to an existing JSON file to extend (optional)|

## Usage

In your `webpack.config.js` instantiate the plugin.

```javascript
const TransformJson = require('transform-json-webpack-plugin');

module.exports = {
  // webpack configuration
  // ...
  plugins: [
    new TransformJson({
      // json configuration
    })
  ]
};
```

Here is a basic example that creates a `mainfest.json` file in your output directory:

**webpack.config.js**
```javascript
module.exports = {
  output: {
    path: 'build/'
  },
  // ...
  plugins: [
    new TransformJson({
      filename: 'manifest.json',
      value: {
        gundam: 'wing-zero'
      }
    })
  ]
};

```
That will generate a file that looks like this:

**manifest.json**
```json
{
  "gundam": "wing-zero"
}
```

Here is a basic example that creates a production deployment version of your `package.json` file in your output directory:

**webpack.config.js**
```javascript
module.exports = {
  output: {
    path: 'build/'
  },
  // ...
  plugins: [
    new TransformJson({
      filename: 'package.json',
      source: __dirname + "/package.json",
      object: {
        devDependencies: {},
        scripts: {"start": "node index.js"}
      }
    })
  ]
};

```
That will generate a file that looks like this:

**package.json**
```json
{
  "name": "your-project",
  "version": "0.0.1",
  "dependencies": { "express": "^4.16.3" },
  "devDependencies": {},
  "scripts": {"start": "node index.js"}
}
```

## License

[MIT](./LICENSE)

[npm]: https://img.shields.io/npm/v/transform-json-webpack-plugin.svg
[npm-url]: https://www.npmjs.com/package/transform-json-webpack-plugin
[node]: https://img.shields.io/node/v/transform-json-webpack-plugin.svg
[node-url]: https://nodejs.org
[size]: https://packagephobia.now.sh/badge?p=transform-json-webpack-plugin
[size-url]: https://packagephobia.com/result?p=transform-json-webpack-plugin

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