forked from philschatz/gh-board
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
65 lines (61 loc) · 2.45 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
var path = require("path");
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var isBuild = process.env['NODE_ENV'] === 'production';
var config = {
// devtool: '#eval-source-map',
devtool: 'source-map',
context: path.resolve(__dirname),
entry: [
// The following is added when `isBuild = falsy`
// 'webpack-dev-server/client?http://0.0.0.0:8080', // WebpackDevServer host and port
//'webpack/hot/only-dev-server',
'./style/index.js',
'./src/index.js'
],
output: {
path: __dirname + '/dist',
publicPath: './dist/', // gh-pages needs this to have a '.' for bundles
filename: 'bundle.js'
},
plugins: [
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin('app.css')
],
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']} },
{ 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: {
// hot: true // Added when `isBuild = falsy`
}
};
if (isBuild) {
// Remove React warnings and whatnot
config.plugins.unshift(new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } }));
} else {
config.debug = true;
config.output.publicPath = '/dist/'; // Dev server needs this to not have a dot.
// config.entry.unshift('webpack/hot/only-dev-server');
config.entry.unshift('webpack-dev-server/client?http://0.0.0.0:8080');
config.devServer.hotComponents = true;
}
module.exports = config;