2016-02-27 21:53:11 +00:00
|
|
|
var path = require('path');
|
|
|
|
var webpack = require('webpack');
|
2016-05-04 06:43:43 +00:00
|
|
|
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
2016-02-27 21:53:11 +00:00
|
|
|
|
|
|
|
// Load .env
|
|
|
|
require('dotenv').config();
|
|
|
|
|
|
|
|
var definePlugin = new webpack.DefinePlugin({
|
2016-05-24 05:20:16 +00:00
|
|
|
__DEV__: JSON.stringify(JSON.parse(process.env.NODE_ENV !== 'production')),
|
|
|
|
__PRERELEASE__: JSON.stringify(JSON.parse(process.env.BUILD_PRERELEASE || 'false')),
|
2016-07-26 05:49:32 +00:00
|
|
|
SLACK_REDIRECT_URI: JSON.stringify(process.env.SLACK_REDIRECT_URI),
|
|
|
|
SLACK_KEY: JSON.stringify(process.env.SLACK_KEY),
|
2016-08-23 06:37:01 +00:00
|
|
|
URL: JSON.stringify(process.env.URL),
|
2016-02-27 21:53:11 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
|
|
|
filename: 'bundle.js',
|
|
|
|
publicPath: '/static/'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel',
|
2016-07-24 22:32:31 +00:00
|
|
|
include: path.join(__dirname, 'frontend')
|
2016-02-27 21:53:11 +00:00
|
|
|
},
|
|
|
|
{ test: /\.json$/, loader: 'json-loader' },
|
2016-05-04 06:43:43 +00:00
|
|
|
{
|
|
|
|
test: /\.s?css$/,
|
|
|
|
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap')
|
|
|
|
},
|
2016-04-29 05:25:37 +00:00
|
|
|
{ test: /\.(png|jpg|svg)$/, loader: 'url-loader' }, // inline base64 URLs for <=8k images, direct URLs for the rest
|
2016-05-04 06:43:43 +00:00
|
|
|
{
|
|
|
|
test: /\.woff$/,
|
|
|
|
loader: 'url-loader?limit=1&mimetype=application/font-woff&name=public/fonts/[name].[ext]'
|
|
|
|
},
|
2016-06-04 19:30:05 +00:00
|
|
|
|
|
|
|
// Excludes
|
|
|
|
{
|
|
|
|
// slug
|
|
|
|
test: /unicode/,
|
|
|
|
loader: 'ignore-loader',
|
|
|
|
}
|
2016-02-27 21:53:11 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
2016-07-24 22:32:31 +00:00
|
|
|
root: path.join(__dirname, 'frontend'),
|
2016-02-27 21:53:11 +00:00
|
|
|
// you can now require('file') instead of require('file.json')
|
|
|
|
extensions: ['', '.js', '.json']
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
definePlugin,
|
|
|
|
new webpack.ProvidePlugin({
|
2016-04-29 05:25:37 +00:00
|
|
|
'fetch': 'imports?this=>global!exports?global.fetch!isomorphic-fetch'
|
2016-02-27 21:53:11 +00:00
|
|
|
}),
|
2016-05-24 06:27:43 +00:00
|
|
|
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en)$/)
|
2016-06-05 01:28:14 +00:00
|
|
|
],
|
2016-07-24 22:32:31 +00:00
|
|
|
};
|