forked from Neufund/ico-transparency-monitor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
72 lines (67 loc) · 1.74 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
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';
const config = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'main.js',
},
plugins: [
// Copy our app's index.html to the build folder.
new CopyWebpackPlugin([
{ from: './public/index.html', to: 'index.html' },
{ from: './public/favicon.ico', to: 'favicon.ico' },
{ from: './public/social_logo.jpg', to: 'social_logo.jpg' },
]),
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
}),
],
node: {
__filename: true,
},
module: {
rules: [
{
test: /\.s?css$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader', options: { minimize: isProduction } },
{ loader: 'sass-loader' },
],
},
{ test: /\.json$/, use: 'json-loader' },
{
test: /\.js$/,
loader: 'babel-loader',
exclude: {
test: path.resolve(__dirname, 'node_modules'),
exclude: path.resolve(__dirname, 'node_modules/web3-provider-engine'), // allow some untranspiled modules
},
},
{
test: /\.(jpg|png)$/,
loader: 'url-loader',
options: {
limit: 25000,
},
},
{
test: /\.(ttf|svg|eot|otf)$/,
loader: 'file-loader',
options: {
name: 'fonts/[hash].[ext]',
},
},
],
},
};
if (isProduction) {
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
}
module.exports = config;