1 | # Prefresh-snowpack
|
2 |
|
3 | [![npm version](https://badgen.net/npm/v/@prefresh/snowpack)](https://www.npmjs.com/package/@prefresh/snowpack)
|
4 |
|
5 | ## Setup
|
6 |
|
7 | If you're using the [`preact-template`](https://github.com/pikapkg/create-snowpack-app/tree/master/packages/app-scripts-preact) you'll get this behavior
|
8 | out of the box, if you don't or are using the old version fo it you'll have to follow these instructions.
|
9 |
|
10 | ```
|
11 | npm i -s @prefresh/snowpack
|
12 | ## OR
|
13 | yarn add @prefresh/snowpack
|
14 | ```
|
15 |
|
16 | You'll have to add a few things, as seen in [this PR](https://github.com/pikapkg/create-snowpack-app/pull/54/files).
|
17 |
|
18 | Add `react-refresh/babel` to your `babel.config.json`:
|
19 |
|
20 | ```json
|
21 | {
|
22 | "presets": [["@babel/preset-react", {
|
23 | "pragma": "h",
|
24 | "pragmaFrag": "Fragment"
|
25 | }], "@babel/preset-typescript"],
|
26 | "plugins": ["@babel/plugin-syntax-import-meta", "react-refresh/babel"]
|
27 | }
|
28 | ```
|
29 |
|
30 | After adding it to your `babel-config` you'll have to make sure your `snowpack.config.json` contains both `plugin-babel` and `@prefresh/snowpack`
|
31 |
|
32 | ```json
|
33 | {
|
34 | "plugins": [
|
35 | "@snowpack/plugin-babel",
|
36 | "@prefresh/snowpack"
|
37 | ]
|
38 | }
|
39 | ```
|