Permalink
Browse files

Hot Module Reload

  • Loading branch information...
denispasin committed Apr 6, 2018
1 parent ff97e6a commit 67863e7075c2ff09c408cb46a785611118ee887e
Showing with 58 additions and 7 deletions.
  1. +2 −1 .babelrc
  2. +4 −3 package.json
  3. +4 −1 src/component/app.jsx
  4. +4 −1 webpack.dev.babel.js
  5. +44 −1 yarn.lock
@@ -2,5 +2,6 @@
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
],
"plugins": ["react-hot-loader/babel"]
}
@@ -12,8 +12,8 @@
"common:babel": "babel webpack.common.babel.js > webpack.common.js",
"dev:babel": "yarn common:babel && babel webpack.dev.babel.js > webpack.dev.js",
"prod:babel": "yarn common:babel && babel webpack.prod.babel.js > webpack.prod.js",
"dev": "yarn dev:babel && webpack-dev-server -d --progress --config webpack.dev.js",
"dev:build": "yarn dev:babel && webpack --config webpack.dev.js --progress -d --watch",
"dev": "yarn dev:babel && webpack-dev-server -d --progress --config webpack.dev.js --hot",
"dev:build": "yarn dev:babel && webpack --config webpack.dev.js --progress -d",
"prod:build": "yarn prod:babel && webpack --config webpack.prod.js --progress -p"
},
"devDependencies": {
@@ -42,6 +42,7 @@
"jquery": "^3.3.1",
"lodash": "^4.17.5",
"react": "^16.3.1",
"react-dom": "^16.3.1"
"react-dom": "^16.3.1",
"react-hot-loader": "^4.0.1"
}
}
@@ -1,10 +1,11 @@
import React from 'react'
import { hot } from 'react-hot-loader'
import frustrationGif from '../frustration.gif'
import UserList from './user-list'
import MarginDiv from './margin-div'
export default ({ users }) => (
const App = ({ users }) => (
<div className="app">
<h1>my nice title</h1>
<MarginDiv>
@@ -20,3 +21,5 @@ export default ({ users }) => (
<p>no color here</p>
</div>
)
export default hot(module)(App)
@@ -1,4 +1,5 @@
import merge from 'webpack-merge'
import webpack from 'webpack'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import common from './webpack.common'
@@ -11,13 +12,15 @@ const client = {
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
hot: true,
},
plugins: [
new webpack.NamedModulesPlugin(),
new ExtractTextPlugin({
filename: 'css/styles.css',
allChunks: true,
}),
]
],
}
export default merge(common, client)

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 67863e7

Please sign in to comment.