-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathwebpack.config.js
94 lines (90 loc) · 2.71 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* ./webpack.config.js
*/
const webpack = require("webpack");
const path = require('path');
const fs = require('fs')
const TerserPlugin = require('terser-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const allowedDomains = [
'https://explorer.horizen.global',
'https://explorer.zensystem.io',
'https://explorer-testnet.horizen.global',
'https://explorer-testnet.zensystem.io',
].join(' ');
module.exports = {
devtool: "source-map",
entry: {
index: './app/index.js',
faq: './app/faq.js',
guide: './app/guide.js'
},
output: {
path: path.resolve('dist'),
filename: 'js/[name].js'
},
module: {
rules: [
{ test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ["@babel/preset-env", "@babel/preset-react"]
}
}
},
{ test: /\.css$/, use: [ 'style-loader', 'css-loader' ] },
{
test: /\.jpe?g$|\.ico$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
loader: 'file-loader?name=[name].[ext]' // <-- retain original file name
}
]
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
keep_fnames: true,
safari10: true,
},
}),
],
},
plugins: [
new HtmlWebpackPlugin({
favicon: 'assets/images/favicon.ico',
template: './app/index.html',
chunks: ['index'],
filename: 'index.html',
inject: 'body',
customDomain: 'https://' + process.env.CUSTOM_DOMAIN,
customLocalDomain: allowedDomains
}),
new HtmlWebpackPlugin({
favicon: 'assets/images/favicon.ico',
template: './app/index.html',
chunks: ['faq'],
filename: 'faq.html',
inject: 'body',
customDomain: 'https://' + process.env.CUSTOM_DOMAIN,
customLocalDomain: allowedDomains
}),
new HtmlWebpackPlugin({
favicon: 'assets/images/favicon.ico',
template: './app/index.html',
chunks: ['guide'],
filename: 'guide.html',
inject: 'body',
customDomain: 'https://' + process.env.CUSTOM_DOMAIN,
customLocalDomain: allowedDomains
}),
new webpack.DefinePlugin({
global: 'window' // Placeholder for global used in any node_modules
})
],
node: {
fs: 'empty',
global: false
}
}