forked from philschatz/gh-board
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
64 lines (61 loc) · 2.04 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
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const isBuild = process.env['NODE_ENV'] === 'production';
const config = {
// devtool: '#eval-source-map',
debug: !isBuild,
devtool: 'source-map',
context: path.resolve(__dirname),
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'
},
plugins: [
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin('app.css')
].concat(isBuild ? [
new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } })
] : []),
module: {
preLoaders: [
{ test: /\.jsx?$/, loader: 'eslint-loader', exclude: [/node_modules|gantt-chart.*/, /octokat\.js/] },
],
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: [/node_modules/, /puzzle-script/, /octokat\.js/],
query: {
presets: ['react', 'es2015'],
plugins: ['transform-object-rest-spread']
}
},
{ test: /\.json$/, loader: 'json-loader'},
{ test: /\.less$/, loader: ExtractTextPlugin.extract('css!less') },
{ test: /\.(png|jpg|svg)/, loader: 'file-loader?name=[name].[ext]'},
{ test: /\.(woff|woff2|eot|ttf)/, loader: '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')
},
},
devServer: {
hotComponents: !isBuild
}
};
module.exports = config;