This repository has been archived by the owner on Jul 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
74 lines (69 loc) · 1.73 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
73
74
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const DashboardPlugin = require('webpack-dashboard/plugin');
const nib = require('nib');
module.exports = {
mode: 'development',
devtool: 'eval-source-map',
devServer: {
allowedHosts: [
'.zooniverse.org'
],
historyApiFallback: true,
contentBase: path.join(__dirname, '/src/'),
inline: true,
port: 3005 // Change this for your project
},
entry: [
'eventsource-polyfill', // necessary for hot reloading with IE
path.join(__dirname, 'src/index.jsx')
],
output: {
path: path.join(__dirname, '/dist/'),
filename: '[name].js',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.tpl.html',
inject: 'body',
filename: 'index.html',
gtm: ''
}),
new webpack.NoEmitOnErrorsPlugin(),
new DashboardPlugin({ port: 3001 }) // Change this here and in the package.json start script if needed
],
resolve: {
extensions: ['.js', '.jsx', '.styl'],
modules: ['.', 'node_modules']
},
module: {
rules: [{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: [
'babel-loader'
// 'eslint-loader' uncomment if you want to use eslint while compiling
]
}, {
test: /\.(jpg|png|gif|otf|eot|svg|ttf|woff\d?)$/,
use: 'file-loader'
}, {
test: /\.styl$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'stylus-loader',
options: {
use: [nib()]
}
}]
}]
},
node: {
fs: 'empty' // workaround for the webpack shimming not working with certain dependencies
}
};