Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hot module reload #240

Merged
merged 9 commits into from
Mar 1, 2016
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"browser-tests": "./node_modules/karma/bin/karma start --browsers PhantomJS,Chrome",
"node-tests": "mocha test/node/ && mocha test/node/**/*.js",
"karma-watch": "./node_modules/karma/bin/karma start --no-single-run",
"start": "bash ./scripts/config.sh && webpack -d --progress --colors --watch",
"start": "bash ./scripts/config.sh && webpack-dev-server --hot --inline --progress --colors",
"build": "bash ./scripts/build.sh",
"lint": "./node_modules/.bin/eslint lib test"
},
Expand Down Expand Up @@ -62,13 +62,16 @@
"phantomjs-prebuilt": "2.1.3",
"proxyquire": "1.7.4",
"react-addons-test-utils": "0.14.7",
"react-hot-loader": "^1.3.0",
"redux-devtools": "3.0.2",
"redux-devtools-dock-monitor": "1.0.1",
"redux-devtools-log-monitor": "1.0.2",
"redux-logger": "2.4.0",
"redux-mock-store": "0.0.6",
"salinity": "0.0.8",
"style-loader": "0.13.0",
"webpack": "1.12.12"
"webpack": "1.12.12",
"webpack-dev-server": "^1.14.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please lock down these dependencies - we don't use ^. (You can do npm install --save-exact in future to avoid having to remember to change in the package.json.)

"write-file-webpack-plugin": "^3.1.7"
}
}
16 changes: 12 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var path = require('path');
var _ = require('lodash');
var webpack = require('webpack');
var WriteFilePlugin = require('write-file-webpack-plugin');

var definePlugin = new webpack.DefinePlugin({
// this first as advised to get the correct production build of redux
Expand Down Expand Up @@ -30,20 +31,27 @@ if ((!process.env.API_URL || !process.env.UPLOAD_URL || !process.env.BLIP_URL))

var config = {
entry: './entry.js',
devtool: '#cheap-module-source-map',
devServer: {
outputPath: path.join(__dirname, '/build'),
publicPath: '/build/'
},
output: {
path: path.join(__dirname, '/build'),
filename: 'bundle.js'
filename: 'bundle.js',
publicPath: '/build/',
},
module: {
loaders: [
{ test: /\.js$/, exclude: /(node_modules)/, loader: 'babel-loader' },
{ test: /\.jsx$/, exclude: /(node_modules)/, loader: 'babel-loader' },
{ test: /\.js$/, exclude: /(node_modules)/, loaders: ['react-hot', 'babel-loader'] },
{ test: /\.jsx$/, exclude: /(node_modules)/, loaders: ['react-hot', 'babel-loader'] },
{ test: /\.less$/, loader: 'style!css!less' },
{ test: /\.json$/, loader: 'json' }
]
},
plugins: [
definePlugin
definePlugin,
new WriteFilePlugin()
],
// to fix the 'broken by design' issue with npm link-ing modules
resolve: { fallback: path.join(__dirname, 'node_modules') },
Expand Down