This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/webpack.config.js

58 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-02-27 21:53:11 +00:00
var path = require('path');
var webpack = require('webpack');
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')),
SLACK_REDIRECT_URI: process.env.SLACK_REDIRECT_URI,
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',
include: path.join(__dirname, 'src')
},
{ test: /\.json$/, loader: 'json-loader' },
{
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
{
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-05-24 05:55:42 +00:00
root: path.join(__dirname, 'src'),
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
}),
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en)$/)
2016-02-27 21:53:11 +00:00
]
};