This repository was archived by the owner on Aug 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
48 lines (41 loc) · 1.74 KB
/
webpack.config.js
File metadata and controls
48 lines (41 loc) · 1.74 KB
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
const configBuilder = require('webpack-focus').configBuilder;
const path = require('path');
const API_HOST = process.env.API_HOST || 'localhost';
const API_PORT = process.env.API_PORT || 80;
const LEGACY_SEARCH_API = JSON.parse(process.env.LEGACY_SEARCH_API);
const BASE_URL = process.env.BASE_URL ? process.env.BASE_URL : '';
// Check if focus libraries should be held locally or read from NPM
const localFocus = process.env.LOCAL_FOCUS ? JSON.parse(process.env.LOCAL_FOCUS) : false;
const configuration = {
proxy: null,
externals: {
'react': 'React',
'react-dom': 'ReactDOM',
'redux-devtools': 'redux-devtools',
'react-addons-css-transition-group': {
root: ['React', 'addons', 'CSSTransitionGroup']
},
moment: 'moment',
lodash: 'lodash'
}
};
const customConfig = localFocus ? {
resolve: {
alias: {
'focus-components': path.resolve(process.cwd(), '../focus-components'),
//'focus-application': path.resolve(process.cwd(), '../focus-application'),
//'focus-search': path.resolve(process.cwd(), '../focus-search'),
//'focus-notifications': path.resolve(process.cwd(), '../focus-notifications'),
'i18next': path.resolve(process.cwd(), './node_modules/i18next'),
'react' : path.resolve(process.cwd(), './node_modules/react'),
'react-dom' : path.resolve(process.cwd(), './node_modules/react-dom'),
}
}
} : {};
Object.assign(configuration, customConfig);
const globals = {
__API_ROOT__: JSON.stringify(`http://${API_HOST}:${API_PORT}/`),
__LEGACY_SEARCH_API__: JSON.stringify(LEGACY_SEARCH_API),
__BASE_URL__: `'${BASE_URL}'`
}
module.exports = configBuilder(configuration, globals);