This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
71 lines (65 loc) · 1.75 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
/**
* Import dependencies
*/
const auroraWebpackConfig = require('aurora-core/webpack.config.js');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const {
apiUrl,
hostname,
nodeEnv,
} = require('./config');
/**
* Environment
*/
const isProduction = nodeEnv === 'production';
/**
* Export a webpack plugin that extends the one from aurora-core
*/
module.exports = Object.assign({}, auroraWebpackConfig, {
/**
* Source maps
*/
devtool: isProduction ? 'cheap-source-map' : 'cheap-module-source-map',
/**
* Replace the entry file name
*/
entry: auroraWebpackConfig.entry.slice().reverse().slice(1).reverse()
.concat([
'./src/client-bootstrap',
]),
/**
* Extend the plugin array
*/
plugins: auroraWebpackConfig.plugins.concat([
new webpack.DefinePlugin({
'__DEVELOPMENT__': JSON.stringify(!isProduction),
'process.env.NODE_ENV': JSON.stringify(nodeEnv),
'process.env.API_URL': JSON.stringify(apiUrl),
'process.env.HOSTNAME': JSON.stringify(hostname),
}),
]),
/**
* Extend the output to make it work with the dev-server
*/
output: Object.assign({}, auroraWebpackConfig.output, {
path: path.join(__dirname, '/public/static/'),
publicPath: '/static/',
}),
/**
* Add resolver aliases that
* we want to ignore in our
* webpack bundle
*
* NOTE: We just replace any server specific modules with a no-op (from npm)
*/
resolve: Object.assign({}, auroraWebpackConfig.resolve, {
alias: Object.assign({}, (auroraWebpackConfig.resolve || {}).alias, {
'redis': 'no-op',
'mmdb-reader': 'no-op',
'big-integer': 'no-op',
}),
extensions: ['.js', '.jsx', '.json'],
}),
});