forked from openedx-unsupported/frontend-app-payment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.config.js
35 lines (28 loc) · 1.09 KB
/
webpack.prod.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
const { getBaseConfig } = require('@edx/frontend-build');
// NOTE: This version of html-webpack-plugin must be the same major version as the one in
// frontend-build to avoid potential issues.
/**
* This plugin configuration edits the default in webpack-prod for the following reasons:
*
* We need to have a custom html-webpack-plugin configuration to allow us to preconnect to
* various domains. See the public/index.html file for the companion usage of this configuration.
*/
const config = getBaseConfig('webpack-prod');
/* eslint-disable no-param-reassign */
config.plugins.forEach((plugin) => {
if (plugin.constructor.name === 'HtmlWebpackPlugin') {
const preconnectDomains = [
'https://api.segment.io',
'https://cdn.segment.com',
'https://www.google-analytics.com',
];
if (process.env.LMS_BASE_URL) {
preconnectDomains.push(process.env.LMS_BASE_URL);
}
if (process.env.OPTIMIZELY_PROJECT_ID) {
preconnectDomains.push('https://logx.optimizely.com');
}
plugin.userOptions.preconnect = preconnectDomains;
}
});
module.exports = config;