-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
64 lines (62 loc) · 1.37 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
const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const IS_DEV = process.env.NODE_ENV !== 'production';
module.exports = {
mode: IS_DEV ? 'development' : 'production',
target: 'node',
entry: './src/main.js',
output: {
path: path.join(__dirname, 'build'),
filename: 'main.js'
},
devtool: 'source-map',
externals: [nodeExternals({})],
module: {
rules: [
{
test: /\.(gql|graphql)/,
use: 'graphql-tag/loader'
},
{
test: /\.js$/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
babelrc: true,
cacheDirectory: true
}
}
]
}
]
},
node: {
__filename: true,
__dirname: true
},
optimization: {
noEmitOnErrors: true
},
performance: {
hints: false
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
new webpack.EnvironmentPlugin({
DEBUG: true,
NODE_ENV: 'development'
}),
new FriendlyErrorsWebpackPlugin({ clearConsole: IS_DEV })
],
resolve: {
extensions: ['.js']
},
stats: 'minimal',
devServer: {
contentBase: path.join(__dirname, 'build'),
port: 4000
}
};