# fix-hmr

> In some cases, such as styled-components, code renewal by HMR is not performed properly.

Latest version **1.0.2** (published 2021-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install fix-hmr
pnpm add fix-hmr
yarn add fix-hmr
bun add fix-hmr
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-06-23 |
| First published | 2021-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | SSen |
| Maintainers | ssen |

## Links

- npm: https://www.npmjs.com/package/fix-hmr
- Repository: https://github.com/rocket-hangar/vite-templates
- Homepage: https://github.com/rocket-hangar/vite-templates/tree/main/source/src/fix-hmr
- Issues: https://github.com/rocket-hangar/vite-templates/issues
- npm.io page: https://npm.io/package/fix-hmr

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^17.0.2

## Recent versions

- 1.0.2 (latest) — 2021-06-23
- 1.0.1 — 2021-06-22
- 1.0.0 — 2021-06-22

## README

# `fix-hmr`

In some cases, such as styled-components, code renewal by HMR is not performed properly.

This function fixes some cases in which HMR is not working.

## Usage

```jsx
import styled from 'styled-components'

function ComponentBase({className}) {
  return <div className={className} />
}

export const Component = styled(ComponentBase)`
  font-size: 1em;
`
```

If HMR doesn't work,

```jsx
import { fixHMR } from 'fix-hmr'
import styled from 'styled-components'

function ComponentBase({className}) {
  return <div className={className}/>
}

const StyledComponent = styled(ComponentBase)`
  font-size: 1em;
`

export const Component = fixHMR(StyledComponent)
```

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