# @dwatts3624/vue-keep-alive-dev

> A plugin to resolve HMR issues with the core keep-alive plugin

Latest version **0.0.1** (published 2020-07-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dwatts3624/vue-keep-alive-dev
pnpm add @dwatts3624/vue-keep-alive-dev
yarn add @dwatts3624/vue-keep-alive-dev
bun add @dwatts3624/vue-keep-alive-dev
```

## 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.1 |
| Published | 2020-07-11 |
| First published | 2020-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Danny Watts |
| Maintainers | dwatts3624 |
| Keywords | vue, keep-alive |

## Links

- npm: https://www.npmjs.com/package/@dwatts3624/vue-keep-alive-dev
- Repository: https://github.com/dwatts3624/vue-keep-alive-dev
- Homepage: https://github.com/dwatts3624/vue-keep-alive-dev#readme
- Issues: https://github.com/dwatts3624/vue-keep-alive-dev/issues
- npm.io page: https://npm.io/package/@dwatts3624/vue-keep-alive-dev

## Recent versions

- 0.0.1 (latest) — 2020-07-11

## README

# VueKeepAliveDev
This plugin resolves an issue where webpack's Hot Module Replacement (MHR) doesn't work for `keep-alive` components (e.g. `router-view`, etc).

## Credit
Full credit to nailfar & ericwu-wish in https://github.com/vuejs/vue-loader/issues/1332 for this *entire* solution.  I just packaged it up to make this easier as I was struggling to deal with the suggested workarounds that just disable `keep-alive` in development with exclude patterns or a dynamic component.  I quickly noticed that this creates a completely different hook flow where the created/activated/deactived/destroyed hooks would have be tuned based on local vs production and it was getting ugly!

## Installation

### 1. Install
```sh
yarn add vue-keep-alive-dev
# or
npm i vue-keep-alive-dev --save
```

### 2. Activate
```js
import VueKeepAliveDev from 'vue-keep-alive-dev'

Vue.use(VueKeepAliveDev, {
  environment: 'development' // Your environment when HMR is in use
});
```

### 3. Run

In your package.json ensure that the `NODE_ENV` lines up with whatever you're setting when compiling Vue.

Example:
```json
{
  "scripts": {
    "dev": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --inline --hot --config=webpack.config.js"
  }
}
```

## Configuration

* `environment` - The `NODE_ENV` when HMR is in use.  Defaults to `development`.

## License
MIT

---
_Source: https://npm.io/package/@dwatts3624/vue-keep-alive-dev · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
