Instantly share code, notes, and snippets.

@jrm2k6 /home.blade.php Secret
Last active Dec 12, 2016

Embed
What would you like to do?
Hot reloading config
<!DOCTYPE html>
<html>
<head>
@include('layout._styles')
</head>
<body>
<div id="react-content"></div>
<script src="http://localhost:3000/static/bundle.js"></script>
</body>
</html>
{
"private": true,
"devDependencies": {
"babel-core": "^5.8.22",
"babel-loader": "^5.3.2",
"gulp": "^3.8.8",
"jsx-loader": "^0.13.2",
"laravel-elixir-react": "^0.1.1",
"laravel-elixir-webpack": "^0.1.4",
"react-hot-loader": "^1.2.9",
"redux-devtools": "^1.1.0",
"webpack": "^1.11.0",
"webpack-dev-server": "^1.10.1"
},
"dependencies": {
"jquery": "^2.1.4",
"laravel-elixir": "^3.0.0",
"lodash": "^3.10.1",
"q": "^1.4.1",
"react": "^0.14.0-beta1",
"react-dom": "^0.14.0-beta1",
"react-redux": "^0.9.0",
"react-router": "^1.0.0-beta3",
"redux": "^1.0.1",
"redux-react-router": "^0.4.0",
"redux-thunk": "^0.1.0",
"request": "^2.61.0"
},
"scripts": {
"start": "node server.js"
}
}
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true
}).listen(3000, 'localhost', function (err, result) {
if (err)
console.log(err);
console.log('Listening at localhost:3000');
});
var webpack = require('webpack');
var path = require('path');
module.exports = {
context: __dirname + '/resources/assets',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./jsx/app.jsx',
],
output: {
path: __dirname + '/public/js',
filename: "bundle.js",
publicPath: 'http://localhost:3000/static/'
},
module: {
loaders: [
{ test: /\.jsx?$/, loaders: ['react-hot', 'jsx?harmony'], include: __dirname + '/resources/assets'},
{ test: /\.jsx$/, exclude: /node_modules/, loaders: ['jsx-loader?insertPragma=React.DOM&harmony']},
{ test: /\.jsx$/, exclude: /node_modules/, loader: 'babel-loader'},
]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment