-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.babel.js
83 lines (80 loc) · 2.1 KB
/
webpack.config.babel.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
75
76
77
78
79
80
81
82
83
import HtmlWebpackPlugin from 'html-webpack-plugin'
import webpack from 'webpack'
const IS_E2E = process.env.NODE_ENV === 'e2e'
const entry = {
app: './src/index.js'
}
if (IS_E2E) {
entry['e2e/swLoader'] = './e2e/swLoader.js'
entry['sw'] = './e2e/sw.js'
}
export default {
entry,
output: {
filename: '[name].js',
path: __dirname + '/dist/',
},
resolve: {
alias: {
npm: `${__dirname}/node_modules`,
},
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: [/node_modules/],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/network-request.html',
inject: 'head',
chunks: IS_E2E && ['e2e/swLoader'],
}),
new webpack.DefinePlugin({
COMPILED: true,
__OFFLINE__: process.env.NODE_ENV === 'offline',
}),
],
devServer: {
https: IS_E2E,
setup: function(app) {
app.get('/euro.json', function(req, res) {
res.set('Access-Control-Allow-Origin', '*');
res.set('Access-Control-Allow-Headers', 'X-Requested-With');
setTimeout(function() {
res.end(
JSON.stringify({
time: {
updated: 'Aug 27, 2017 08:52:00 UTC',
updatedISO: '2017-08-27T08:52:00+00:00',
updateduk: 'Aug 27, 2017 at 09:52 BST',
},
disclaimer:
'This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org',
bpi: {
USD: {
code: 'USD',
rate: '4,386.2625',
description: 'United States Dollar',
rate_float: 4386.2625,
},
EUR: {
code: 'EUR',
rate: '3,678.0522',
description: 'Euro',
rate_float: 3678.0522,
},
},
}),
)
}, 1000)
})
},
contentBase: ['dist/'],
host: '0.0.0.0',
},
}