2016-06-27 22:46:08 +00:00
|
|
|
var webpack = require('webpack');
|
|
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
2016-11-08 23:11:12 +00:00
|
|
|
var ManifestPlugin = require('webpack-manifest-plugin');
|
|
|
|
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
|
2016-06-28 18:41:15 +00:00
|
|
|
var cssnext = require('postcss-cssnext');
|
|
|
|
var postcssFocus = require('postcss-focus');
|
|
|
|
var postcssReporter = require('postcss-reporter');
|
|
|
|
var cssnano = require('cssnano');
|
2016-07-21 00:59:37 +00:00
|
|
|
require('dotenv').config();
|
2016-06-27 22:46:08 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2016-06-28 18:41:15 +00:00
|
|
|
devtool: 'hidden-source-map',
|
|
|
|
|
2016-11-08 23:11:12 +00:00
|
|
|
entry: {
|
|
|
|
app: [
|
|
|
|
'babel-polyfill',
|
2016-11-08 23:54:54 +00:00
|
|
|
'./client/index.jsx'
|
2016-11-08 23:11:12 +00:00
|
|
|
],
|
|
|
|
vendor: [
|
|
|
|
'react',
|
|
|
|
'react-dom'
|
|
|
|
]
|
|
|
|
},
|
2016-06-27 22:46:08 +00:00
|
|
|
output: {
|
2016-06-28 18:41:15 +00:00
|
|
|
path: __dirname + '/static/dist',
|
2016-11-08 23:11:12 +00:00
|
|
|
filename: '[name].[chunkhash].js',
|
2016-06-27 22:46:08 +00:00
|
|
|
publicPath: '/dist/'
|
|
|
|
},
|
|
|
|
|
|
|
|
resolve: {
|
|
|
|
extensions: ['', '.js', '.jsx'],
|
2016-11-08 23:11:12 +00:00
|
|
|
modules: [
|
|
|
|
'client',
|
|
|
|
'node_modules',
|
|
|
|
]
|
2016-06-27 22:46:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
exclude: /node_modules/,
|
2016-11-08 23:11:12 +00:00
|
|
|
loader: ExtractTextPlugin.extract('style', 'css!sass!postcss')
|
2016-06-27 22:46:08 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'babel'
|
|
|
|
},
|
|
|
|
{
|
2016-08-15 15:51:11 +00:00
|
|
|
test: /\.(svg|mp3)$/,
|
2016-06-27 22:46:08 +00:00
|
|
|
loader: 'file'
|
2016-08-19 17:13:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
|
|
|
loader: 'file'
|
2016-06-27 22:46:08 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
2016-07-20 23:48:00 +00:00
|
|
|
'NODE_ENV': JSON.stringify('production'),
|
|
|
|
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"'
|
2016-06-27 22:46:08 +00:00
|
|
|
}
|
|
|
|
}),
|
2016-11-08 23:11:12 +00:00
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
|
name: 'vendor',
|
|
|
|
minChunks: Infinity,
|
|
|
|
filename: 'vendor.js',
|
|
|
|
}),
|
|
|
|
new ExtractTextPlugin('app.[chunkhash].css', { allChunks: true }),
|
|
|
|
new ManifestPlugin({
|
|
|
|
basePath: '/',
|
|
|
|
}),
|
|
|
|
new ChunkManifestPlugin({
|
|
|
|
filename: "chunk-manifest.json",
|
|
|
|
manifestVariable: "webpackManifest",
|
|
|
|
}),
|
2016-07-22 22:56:54 +00:00
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
2016-10-18 16:59:54 +00:00
|
|
|
compress: {
|
2016-07-22 22:56:54 +00:00
|
|
|
warnings: false
|
|
|
|
}
|
|
|
|
})
|
2016-06-28 18:41:15 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
postcss: () => [
|
|
|
|
postcssFocus(),
|
|
|
|
cssnext({
|
|
|
|
browsers: ['last 2 versions', 'IE > 9']
|
|
|
|
}),
|
|
|
|
cssnano({
|
|
|
|
autoprefixer: false
|
|
|
|
}),
|
|
|
|
postcssReporter({
|
|
|
|
clearMessages: true
|
|
|
|
})
|
2016-06-27 22:46:08 +00:00
|
|
|
]
|
|
|
|
};
|