forked from daostack/alchemy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.base.config.js
115 lines (104 loc) · 3.48 KB
/
webpack.base.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ENV = process.env.NODE_ENV || 'development';
const isProd = ENV === 'production';
const isDev = ENV === 'development';
const basePath = process.cwd();
module.exports = {
devtool: 'eval',
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
alias: {
arc: path.resolve(basePath, 'src/arc'),
actions: path.resolve(basePath, 'src/actions'),
components: path.resolve(basePath, 'src/components'),
constants: path.resolve(basePath, 'src/constants'),
data: path.resolve(basePath, 'data'),
genericSchemeRegistry: path.resolve(basePath, 'src/genericSchemeRegistry'),
crxRegistry: path.resolve(basePath, 'src/crxRegistry'),
layouts: path.resolve(basePath, 'src/layouts'),
lib: path.resolve(basePath, 'src/lib'),
pages: path.resolve(basePath, 'src/pages'),
reducers: path.resolve(basePath, 'src/reducers'),
selectors: path.resolve(basePath, 'src/selectors'),
src: path.resolve(basePath, 'src'),
'ipfs-api': 'ipfs-api/dist',
'bn.js': 'bn.js/lib/bn.js'
},
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
loader: ['react-hot-loader/webpack', "awesome-typescript-loader"],
exclude: [/node_modules/, /\.spec\.ts$/]
},
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader",
exclude: [
/node_modules\/apollo-cache-inmemory/,
/node_modules\/apollo-client/,
/node_modules\/apollo-link/,
/node_modules\/apollo-link-http/,
/node_modules\/apollo-link-ws/,
/node_modules\/ethereumjs-common/,
/node_modules\/ethereumjs-tx/,
/node_modules\/ethereumjs-util/,
/node_modules\/graphql-request/,
/node_modules\/https-did-resolver/,
/node_modules\/rlp/,
/node_modules\/subscriptions-transport-ws/,
/node_modules\/xhr2-cookies/,
/node_modules\/zen-observable-ts/,
]
},
// CSS handling
{
test: /\.css$/,
include: /client/,
use: [
'style-loader',
{ // translates CSS into CommonJS (css-loader) and automatically generates TypeScript types
loader: 'typings-for-css-modules-loader',
options: {
camelCase: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
minimize: isProd,
modules: true,
namedExport: true,
sourceMap: true
}
},
],
},
// Images & fonts
{
test: /\.(png|jpg|gif|mp4|ogg|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'url-loader',
options: {
limit: 10000 // For assets smaller than 10k inline them as data urls, otherwise use regular file loader
}
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
}),
new webpack.DefinePlugin({
'VERSION': JSON.stringify(require('./package.json').version)
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};