-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
70 lines (60 loc) · 1.53 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
import webpack from 'webpack';
const config = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
context: __dirname,
entry: { main: './src/index' },
output: {
path: `${__dirname}/dist`,
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.(js(x)?$)/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.(gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
},
{
test: /\.(gif|jpg|png|svg|eot|otf|ttf|woff(2)?)$/,
exclude: /node_modules/,
loader: 'url-loader?name=/[name].[ext]',
options: { limit: 100000 },
},
],
},
resolve: {
alias: {
'react-dom': '@hot-loader/react-dom',
components: `${__dirname}/src/components`,
fonts: `${__dirname}/src/fonts`,
icons: `${__dirname}/src/icons`,
images: `${__dirname}/src/images`,
styles: `${__dirname}/src/styles`,
utils: `${__dirname}/src/utils`,
src: `${__dirname}/src`,
root: `${__dirname}`,
},
},
plugins: [
new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
],
devServer: {
compress: true,
contentBase: 'dist',
disableHostCheck: true,
historyApiFallback: true,
hot: true,
inline: true,
noInfo: true,
port: 8080,
},
devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',
};
export default config;