2016-05-03 04:09:16 +00:00
|
|
|
var webpack = require('webpack');
|
2016-07-20 23:48:00 +00:00
|
|
|
require('dotenv').config();
|
2016-05-03 04:09:16 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
devtool: 'cheap-module-eval-source-map',
|
2016-11-08 23:11:12 +00:00
|
|
|
entry: {
|
|
|
|
app: ['babel-polyfill',
|
|
|
|
'webpack-hot-middleware/client',
|
2016-11-08 23:54:54 +00:00
|
|
|
'./client/index.jsx',
|
2016-11-08 23:11:12 +00:00
|
|
|
],
|
|
|
|
vendor: [
|
|
|
|
'react',
|
|
|
|
'react-dom'
|
|
|
|
]
|
|
|
|
},
|
2016-05-03 04:09:16 +00:00
|
|
|
output: {
|
|
|
|
path: __dirname + '/dist/',
|
2016-11-08 23:11:12 +00:00
|
|
|
filename: 'app.js',
|
2016-05-03 04:09:16 +00:00
|
|
|
publicPath: '/dist/'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['', '.js', '.jsx'],
|
2016-11-08 23:11:12 +00:00
|
|
|
modules: [
|
|
|
|
'client',
|
2016-11-16 18:12:36 +00:00
|
|
|
'node_modules'
|
2016-11-08 23:11:12 +00:00
|
|
|
]
|
2016-05-03 04:09:16 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2016-06-22 22:36:04 +00:00
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
2016-11-08 23:11:12 +00:00
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
|
name: 'vendor',
|
|
|
|
minChunks: Infinity,
|
|
|
|
filename: 'vendor.js',
|
|
|
|
}),
|
2016-06-22 22:36:04 +00:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
2017-03-16 04:34:14 +00:00
|
|
|
API_URL: '"' + process.env.API_URL + '"',
|
2016-06-22 22:36:04 +00:00
|
|
|
CLIENT: JSON.stringify(true),
|
2017-03-30 16:36:26 +00:00
|
|
|
FORCE_TO_HTTPS: process.env.FORCE_TO_HTTPS === 'true' ?
|
|
|
|
JSON.stringify(true) :
|
|
|
|
JSON.stringify(false),
|
2016-06-22 22:36:04 +00:00
|
|
|
'NODE_ENV': JSON.stringify('development'),
|
2017-04-13 18:39:03 +00:00
|
|
|
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"',
|
|
|
|
'AWS_REGION': '"' + process.env.AWS_REGION + '"',
|
2016-06-22 22:36:04 +00:00
|
|
|
}
|
|
|
|
})
|
2016-05-03 04:09:16 +00:00
|
|
|
],
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
2016-06-27 21:40:16 +00:00
|
|
|
test: /\.jsx?$/,
|
2016-05-03 04:09:16 +00:00
|
|
|
exclude: [/node_modules/, /.+\.config.js/],
|
2016-07-22 17:14:26 +00:00
|
|
|
loaders: ['babel', 'eslint-loader']
|
2016-05-03 04:09:16 +00:00
|
|
|
},
|
2016-05-03 20:13:04 +00:00
|
|
|
{
|
2016-05-10 18:18:36 +00:00
|
|
|
test: /\.scss$/,
|
|
|
|
loaders: ['style', 'css', 'sass']
|
2016-05-11 17:19:37 +00:00
|
|
|
},
|
|
|
|
{
|
2016-08-15 15:51:11 +00:00
|
|
|
test: /\.(svg|mp3)$/,
|
2016-05-11 17:19:37 +00:00
|
|
|
loader: 'file'
|
2016-08-18 18:22:47 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
|
|
|
loader: 'file'
|
2016-05-03 20:13:04 +00:00
|
|
|
}
|
2016-05-03 04:09:16 +00:00
|
|
|
],
|
|
|
|
},
|
2016-08-11 17:24:02 +00:00
|
|
|
};
|