docs(data-source): new file locations, react-scripts to webpack, new env variables for proxy

This commit is contained in:
dannyrb committed 2019-09-05 08:45:11 -04:00
1 parent 080183c712
commit c791750f36
8 files changed
+42 -23

No files matched your search

+8
View File
@@ -23,10 +23,13 @@ const PUBLIC_DIR = path.join(__dirname, '../public');
const HTML_TEMPLATE = process.env.HTML_TEMPLATE || 'index.html';
const PUBLIC_URL = process.env.PUBLIC_URL || '/';
const APP_CONFIG = process.env.APP_CONFIG || 'config/default.js';
const PROXY_TARGET = process.env.PROXY_TARGET;
const PROXY_DOMAIN = process.env.PROXY_DOMAIN;
module.exports = (env, argv) => {
const baseConfig = webpackBase(env, argv, { SRC_DIR, DIST_DIR });
const isProdBuild = process.env.NODE_ENV === 'production';
const hasProxy = PROXY_TARGET && PROXY_DOMAIN;
const mergedConfig = merge(baseConfig, {
devtool: isProdBuild ? 'source-map' : 'cheap-module-eval-source-map',
@@ -111,6 +114,11 @@ module.exports = (env, argv) => {
},
});
if (hasProxy) {
mergedConfig.devServer.proxy = {};
mergedConfig.devServer.proxy[PROXY_TARGET] = PROXY_DOMAIN;
}
if (!isProdBuild) {
mergedConfig.plugins.push(new webpack.HotModuleReplacementPlugin());