-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
webpack.config.js
var path = require("path");
var webpack = require('webpack');
module.exports = {
entry: {
app: [
'webpack-dev-server/client?http://0.0.0.0:4000', // WebpackDevServer host and port
'webpack/hot/dev-server', // "only" prevents reload on syntax errors
"./app/main.jsx",
"./app/main.js"
]
},
output: {
path: path.join(__dirname, "dist", "javascript"),
publicPath: "/dist/javascript/",
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.(jsx|es6)$/,
loaders: ['react-hot', 'babel-loader'],
include: path.join(__dirname, 'app')
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
};server.js
var path = require('path');
var webpack = require('webpack');
var config = require("./webpack.config.js");
var compiler = webpack(config);
var WebpackDevServer = require('webpack-dev-server');
config.entry.app.unshift("webpack-dev-server/client?http://localhost:4000", "webpack/hot/dev-server");
var server = new WebpackDevServer(compiler, {
contentBase: './',
hot: true,
inline: true,
stats: {
color: true
},
publicPath: config.output.publicPath
});
server.listen(4000, 'localhost', function (error) {
if (error) {
console.log(error);
}
console.log('Server running at localhost:4000');
});Metadata
Metadata
Assignees
Labels
No labels
