-
Notifications
You must be signed in to change notification settings - Fork 80
/
webpack.dev.config.js
111 lines (97 loc) · 2.96 KB
/
webpack.dev.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
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const baseConfig = require('./webpack.base.config.js');
// tslint:disable-next-line:no-var-requires
require('dotenv').config();
module.exports = merge(baseConfig, {
mode: 'development',
devtool: 'eval-source-map',
devServer: {
contentBase: path.resolve(__dirname, 'src'),
hot: true,
publicPath: '/',
historyApiFallback: true,
port: 3000,
host: '0.0.0.0'
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, 'dist'),
chunkFilename: '[id]-[name].chunk.js',
// necessary for HMR to know where to load the hot update chunks
publicPath: '/'
},
entry: [
// activate HMR for React
'react-hot-loader/patch',
// bundle the client for webpack-dev-server
// and connect to the provided endpoint
'webpack-dev-server/client?http://127.0.0.1:3000',
// bundle the client for hot reloading
// only- means to only hot reload for successful updates
'webpack/hot/only-dev-server',
// the entry point of our app
__dirname + '/src/index.tsx',
],
module: {
rules: [
{
test: /\.scss$/,
use: [
{ // creates style nodes from JS strings
loader: "style-loader"
},
{ // translates CSS into CommonJS (css-loader) and automatically generates TypeScript types
loader: 'typings-for-css-modules-loader',
options: {
camelCase: true,
modules: true,
namedExport: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
importLoaders: 2,
sourceMap: true
}
},
{ // compiles Sass to CSS
loader: "sass-loader",
options: {
sourceMap: true
}
},
{ // Load global scss files in every other scss file without an @import needed
loader: 'sass-resources-loader',
options: {
resources: ['./src/assets/styles/global-variables.scss']
},
},
]
}
],
},
plugins: [
// enable HMR globally
new webpack.HotModuleReplacementPlugin(),
// Prints more readable module names in the browser console on HMR updates
new webpack.NamedModulesPlugin(),
new webpack.EnvironmentPlugin({
NETWORKS: "ganache",
NODE_ENV: "development",
SHOW_ALL_DAOS: "true",
BASE_URL: "http://127.0.0.1:3000",
DISQUS_SITE:'daostack-alchemy',
ARC_GRAPHQLHTTPPROVIDER: "",
ARC_GRAPHQLWSPROVIDER : "",
ARC_WEB3PROVIDER : "",
ARC_WEB3PROVIDERREAD : "",
ARC_IPFSPROVIDER: "",
ARC_IPFSPROVIDER_HOST : "",
ARC_IPFSPROVIDER_PORT : "",
ARC_IPFSPROVIDER_PROTOCOL : "",
ARC_IPFSPROVIDER_API_PATH : "",
INFURA_ID : "",
ETHERSCAN_API_KEY : "",
MIXPANEL_TOKEN: "eac39430f2d26472411099a0407ad610",
})
]
});