unpkg/webpack.config.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-05-16 22:55:24 +00:00
const path = require('path')
const webpack = require('webpack')
const autoprefixer = require('autoprefixer')
2016-07-20 19:26:15 +00:00
const ChunkManifestPlugin = require('chunk-manifest-webpack-plugin')
2016-05-16 22:55:24 +00:00
const ExtractTextPlugin = require('extract-text-webpack-plugin')
2016-07-20 19:26:15 +00:00
const WebpackMD5Hash = require('webpack-md5-hash')
2016-05-16 22:55:24 +00:00
module.exports = {
entry: {
2016-07-20 19:26:15 +00:00
vendor: [ 'react', 'react-dom' ],
2016-05-16 22:55:24 +00:00
home: path.resolve(__dirname, 'modules/client/home.js')
},
output: {
2016-07-20 19:26:15 +00:00
filename: '[chunkhash:8]-[name].js',
2016-05-16 22:55:24 +00:00
path: path.resolve(__dirname, 'public/__assets__'),
publicPath: '/__assets__/'
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
2016-05-20 18:58:58 +00:00
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css!postcss') },
{ test: /\.json$/, loader: 'json' },
{ test: /\.png$/, loader: 'file' },
{ test: /\.md$/, loader: 'html!markdown' }
2016-05-16 22:55:24 +00:00
]
},
plugins: [
2016-07-20 19:26:15 +00:00
new WebpackMD5Hash(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
}),
new ChunkManifestPlugin({
filename: 'chunk-manifest.json',
manifestVariable: 'webpackManifest'
}),
new ExtractTextPlugin('[chunkhash:8]-styles.css'),
2016-05-16 22:55:24 +00:00
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
2016-07-20 19:26:15 +00:00
}),
new webpack.optimize.OccurrenceOrderPlugin()
2016-05-16 22:55:24 +00:00
],
postcss: () => [ autoprefixer ]
}