You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When **webpack-dev-server** is running it will watch your files for changes. When that happens it rebundles your project and notifies browsers listening to refresh. To trigger this behavior you need to change your *index.html* file in the `build/` folder.
2
2
3
-
*build/index.html*
3
+
**build/index.html**
4
4
5
5
```html
6
6
<!DOCTYPE html>
@@ -9,21 +9,24 @@ When **webpack-dev-server** is running it will watch your files for changes. Whe
Thats it! Now your application will automatically refresh on file changes.
35
38
36
39
## Default environment
37
-
In the example above we created our own *index.html* file to give more freedom and control. It is also possible to run the application from **http://localhost:8080/webpack-dev-server/bundle**. This will fire up a default *index.html* file that you do not control. It also fires this file up in an iFrame allowing for a status bar to indicate the status of the rebundling process.
40
+
41
+
In the example above we created our own *index.html* file to give more freedom and control. It is also possible to run the application from **http://localhost:8080/webpack-dev-server/bundle**. This will fire up a default *index.html* file that you do not control. It also fires this file up in an iFrame allowing for a status bar to indicate the status of the rebundling process.
42
+
43
+
> I discuss an alternative, `inline` based approach at the [Developing with Webpack](http://survivejs.com/webpack_react/developing_with_webpack/) chapter of *SurviveJS - Webpack and React*.
Copy file name to clipboardexpand all lines: content/Optimizing-rebundling.md
+16-11
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,13 @@
1
1
You might notice after requiring React JS into your project that the time it takes from a save to a finished rebundle of your application takes more time. In development you ideally want from 200-800 ms rebundle speed, depending on what part of the application you are working on.
2
2
3
+
> IMPORTANT! This setup a minified, production version of React. As a result you will lose `propTypes` based type validation!
4
+
3
5
## Running minified file in development
6
+
4
7
Instead of making Webpack go through React JS and all its dependencies, you can override the behavior in development.
5
8
6
-
*webpack.config.js*
9
+
**webpack.config.js**
10
+
7
11
```javascript
8
12
var path =require('path');
9
13
var node_modules =path.resolve(__dirname, 'node_modules');
@@ -12,25 +16,26 @@ var pathToReact = path.resolve(node_modules, 'react/dist/react.min.js');
0 commit comments