forked from plotly/falcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.web.js
50 lines (39 loc) · 1.31 KB
/
webpack.config.web.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
import webpack from 'webpack';
import baseConfig from './webpack.config.base';
import path from 'path';
const AUTH_ENABLED = process.env.PLOTLY_CONNECTOR_AUTH_ENABLED ?
JSON.parse(process.env.PLOTLY_CONNECTOR_AUTH_ENABLED) : true;
const OAUTH2_CLIENT_ID = process.env.PLOTLY_CONNECTOR_OAUTH2_CLIENT_ID ?
JSON.stringify(process.env.PLOTLY_CONNECTOR_OAUTH2_CLIENT_ID) :
JSON.stringify('isFcew9naom2f1khSiMeAtzuOvHXHuLwhPsM7oPt');
const config = {
...baseConfig,
devtool: 'source-map',
entry: {
'web': './app/index'
},
output: {
...baseConfig.output,
path: path.join(__dirname, 'static'),
filename: '[name]-bundle.min.js',
libraryTarget: 'var'
},
plugins: [
...baseConfig.plugins,
new webpack.DefinePlugin({
__DEV__: false,
'process.env.NODE_ENV': JSON.stringify('production')
}),
// This is used to pass environment variables to frontend
// detailed discussions on this ticket:
// https://github.com/plotly/streambed/issues/10436
new webpack.DefinePlugin({
'PLOTLY_ENV': {
'AUTH_ENABLED': AUTH_ENABLED,
'OAUTH2_CLIENT_ID': OAUTH2_CLIENT_ID
}
})
],
target: 'web'
};
export default config;