forked from coala/gh-board
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
72 lines (70 loc) · 2.14 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const path = require('path');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const isBuild = process.env['NODE_ENV'] === 'production';
module.exports = {
entry: [
'./style/index.js',
'./src/index.js'
].concat(isBuild ? [] : [
'webpack-dev-server/client?http://0.0.0.0:8080'
]),
output: {
path: __dirname + '/dist',
publicPath: isBuild ? './dist/' : '/dist/', // gh-pages needs this to have a '.' for bundles
filename: 'bundle.js'
},
context: path.resolve(__dirname),
devtool: isBuild ? 'source-map' : 'cheap-module-source-map',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: [/node_modules/, /octokat\.js/],
use: [
'babel-inline-import-loader',
'babel-loader',
]
},
{
test: /\.less$/,
use: isBuild ? ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
minimize: true
}
},
'less-loader'
]
}) :
['style-loader', 'css-loader', 'less-loader']
},
{ test: /\.(png|jpg|svg)/, use: 'file-loader?name=[name].[ext]'},
{ test: /\.(woff|woff2|eot|ttf)/, use: 'url-loader?limit=30000&name=[name]-[hash].[ext]' }
]
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
alias: {
xmlhttprequest: path.join(__dirname, '/src/hacks/xmlhttprequest-filler.js'),
fs: path.join(__dirname, '/src/hacks/mermaid-stubs.js'),
proxyquire: path.join(__dirname, '/src/hacks/mermaid-stubs.js'),
rewire: path.join(__dirname, '/src/hacks/mermaid-stubs.js'),
'mock-browser': path.join(__dirname, '/src/hacks/mermaid-stubs.js')
}
},
plugins: isBuild ? [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
REPOSITORIES: JSON.stringify(process.env['REPOSITORIES']),
}),
new ExtractTextPlugin('app.css'),
new UglifyJsPlugin({
sourceMap: true,
})
] : []
};