Skip to content

Commit 30957f0

Browse files
authored
Merge pull request #532 from zackify/patch-1
Add index.html to guide
2 parents 2bc6eae + d6bc38a commit 30957f0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

content/guides/hmr-react.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,24 @@ The important thing to note in the code above is the `module` reference.
235235

236236
So in this case, `module.hot.accept` will fire the `render` method whenever `src/components/App.js` or its dependencies are changed - which means the `render` method will also fire when the `App.css` is changed, since `App.css` is included in `App.js`.
237237

238+
###index.html
239+
240+
This needs to be placed inside of `dist` in your project root. webpack-dev-server will not run without it.
241+
242+
```html
243+
<!DOCTYPE html>
244+
<html lang="en">
245+
<head>
246+
<meta charset="UTF-8">
247+
<title>Example Index</title>
248+
</head>
249+
<body>
250+
<div id="root"></div>
251+
<script src="bundle.js"></script>
252+
</body>
253+
</html>
238254

255+
```
239256
### Package.json
240257

241258
Finally, we need to start up `webpack-dev-server` to bundle our code and see HMR in action.

0 commit comments

Comments
 (0)