Skip to content

Instantly share code, notes, and snippets.

@bjrmatos
Created April 8, 2015 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjrmatos/d6d6b18f30853b9acc26 to your computer and use it in GitHub Desktop.
Save bjrmatos/d6d6b18f30853b9acc26 to your computer and use it in GitHub Desktop.
webpack dev server config
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>React Interval</title>
</head>
<body>
<div id="app"></div>
<script src="http://localhost:9000/webpack-dev-server.js"></script>
<script src="/app.js"></script>
</body>
</html>
{
"name": "webpack-playground",
"version": "1.0.0",
"description": "Test webpack",
"main": "app.js",
"scripts": {
"start": "webpack-dev-server --config webpack.config.js --hot",
"build": "webpack --config webpack.config.js --progress --profile --colors",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "BJR Matos <bjrmatos@gmail.com>",
"license": "MIT",
"devDependencies": {
"babel-core": "^5.0.10",
"babel-loader": "^5.0.0",
"webpack": "^1.8.0",
"webpack-dev-server": "^1.8.0"
},
"dependencies": {
"react": "^0.12.2"
}
}
'use strict';
var path = require('path'),
webpack = require('webpack');
module.exports = {
entry: [
'webpack/hot/dev-server',
'./app'
],
devServer: {
contentBase: '.',
host: 'localhost',
port: 9000
},
devtool: 'eval',
debug: true,
output: {
path: path.join(__dirname, 'dist'),
filename: 'app.js'
},
module: {
loaders: [
{ test: /\.js|\.jsx/, loaders: ['babel-loader'], exclude: /node_modules/ }
]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment