Skip to content

Instantly share code, notes, and snippets.

@rowellx68
Created March 12, 2016 15:25
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 rowellx68/362ceaeedf09c83c2b9c to your computer and use it in GitHub Desktop.
Save rowellx68/362ceaeedf09c83c2b9c to your computer and use it in GitHub Desktop.
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' ]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment