Created
January 22, 2016 12:39
-
-
Save alexwilson/80fdd054b27c1386db0c to your computer and use it in GitHub Desktop.
Is this doing it right?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webpack from "webpack"; | |
import WebpackDevServer from "webpack-dev-server"; | |
import config from "./webpack.config"; | |
const host = 'localhost'; | |
const port = 9080; | |
config.devtool = 'eval'; | |
config.entry.push('webpack-dev-server/client?http://'+host+':'+port); | |
config.entry.push('webpack/hot/only-dev-server'); | |
new WebpackDevServer(webpack(config), { | |
publicPath: config.output.publicPath, | |
hot: true, | |
historyApiFallback: true | |
}).listen(port, host, function (err, result) { | |
if (err) { | |
console.log(err); | |
} | |
console.log('Listening at '+host+':'+port); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var webpack = require('webpack'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
module.exports = { | |
entry: [ | |
'./src/index' | |
], | |
output: { | |
filename: 'bundle.js', | |
path: path.join(__dirname, 'build'), | |
publicPath: '/build/' | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
new ExtractTextPlugin('bundle.css', { | |
allChunks: true | |
}) | |
], | |
resolve: { | |
extensions: ['', '.js', '.jsx'] | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
loaders: ['react-hot', 'babel-loader'], | |
include: path.join(__dirname, 'src'), | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.css$/, | |
loader: 'style-loader!css-loader' | |
}, | |
{ | |
test: /\.scss$/, | |
loader: ExtractTextPlugin.extract('css!sass') | |
} | |
] | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment