Created
March 12, 2016 15:25
-
-
Save rowellx68/362ceaeedf09c83c2b9c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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