var path = require('path'); var webpack = require('webpack'); var AssetsPlugin = require('assets-webpack-plugin'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); module.exports = { devtool: 'source-map', entry: { main: [ 'webpack/hot/only-dev-server', 'webpack-hot-middleware/client', './src/client.js' ], vendor: [ 'react', 'react-dom', 'react-router', 'redux', 'react-redux', 'aphrodite', 'superagent' ] }, output: { path: path.join(__dirname, 'dist'), filename: '[name].js', chunkFilename: '[id].chunk.js', publicPath: '/build/static/' }, plugins: [ new webpack.optimize.OccurenceOrderPlugin(), new webpack.HotModuleReplacementPlugin(), new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js', 2), new webpack.NoErrorsPlugin(), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development'), }), new ExtractTextPlugin("[name].css") // extract css. replace with new ExtractTextPlugin("[name]_[hash].css") for prod ], module: { loaders: [{ test: /\.js$/, loaders: ['react-hot', 'babel'], include: path.join(__dirname, 'src') }, { test: /\.scss$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader") // tell the plugin what to extract }] }, resolve: { modulesDirectories: [ 'node_modules' ] } };