# react-static-page-webpack-plugin

> A webpack that generates an html page from a react component

Latest version **1.2.1** (published 2021-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-static-page-webpack-plugin
pnpm add react-static-page-webpack-plugin
yarn add react-static-page-webpack-plugin
bun add react-static-page-webpack-plugin
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2021-02-25 |
| First published | 2019-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | 4Catalyzer |
| Maintainers | monastic.panic |

## Links

- npm: https://www.npmjs.com/package/react-static-page-webpack-plugin
- Repository: https://github.com/4Catalyzer/react-static-page-webpack-plugin
- Homepage: https://github.com/4Catalyzer/react-static-page-webpack-plugin#readme
- Issues: https://github.com/4Catalyzer/react-static-page-webpack-plugin/issues
- npm.io page: https://npm.io/package/react-static-page-webpack-plugin

## Dependencies (1)

- [eval](https://npm.io/package/eval.md) ^0.1.2

## Recent versions

- 1.2.1 (latest) — 2021-02-25
- 1.2.0 — 2021-02-08
- 1.1.0 — 2019-10-07
- 1.0.2 — 2019-03-06
- 1.0.1 — 2019-03-06

## README

# ReactStaticPageWebpackPlugin

A webpack that generates an html page from a react component

## Usage

```sh
yarn add react-static-page-webpack-plugin -D
```

**webpack.config.js**

```js
exports = {
  entry './src/static-page.js',
  output: {
    libraryTarget: 'commonjs'
  }
  plugins: [
    new ReactStaticPageWebpackPlugin({
      fileName: 'static-index.html',
      title: 'My Page Title',
      props: {
        customerName: 'Sally'
      }
    }),
  ],
};
```

And in `./src/static-page.js`:

```js
import React from 'react';

export default function StaticPage({ customerName }) {
  return <main>Hi there: {customerName}</main>;
}
```

When running the webpack build `static-index.html` will be written to your output folder.

### Options

- `chunk`: Specific the entry chunk that returns the body component you want to render, optional, will use the first chunk when omitted
- `fileName`: The output file name
- `title`: A page title placed in teh `<head>`
- `meta`: a _string_ of meta tags placed into the document `<head>`
- `props`: An set of props that is passed to your component.

### Why use a webpack chunk?

The reason we use an entry chunk (instead of providing a filename to the component) is so you can leaverage your existing webpack config for styling, and compilation.

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