-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: patch frontend-build deployment
- Loading branch information
1 parent
23e522e
commit 5f56828
Showing
3 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
diff --git a/node_modules/@openedx/frontend-build/config/webpack.prod.config.js b/node_modules/@openedx/frontend-build/config/webpack.prod.config.js | ||
index 2879dd9..9efd0fc 100644 | ||
--- a/node_modules/@openedx/frontend-build/config/webpack.prod.config.js | ||
+++ b/node_modules/@openedx/frontend-build/config/webpack.prod.config.js | ||
@@ -12,6 +12,7 @@ const NewRelicSourceMapPlugin = require('@edx/new-relic-source-map-webpack-plugi | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const path = require('path'); | ||
+const fs = require('fs'); | ||
const PostCssAutoprefixerPlugin = require('autoprefixer'); | ||
const PostCssRTLCSS = require('postcss-rtlcss'); | ||
const PostCssCustomMediaCSS = require('postcss-custom-media'); | ||
@@ -23,6 +24,23 @@ const HtmlWebpackNewRelicPlugin = require('../lib/plugins/html-webpack-new-relic | ||
const commonConfig = require('./webpack.common.config'); | ||
const presets = require('../lib/presets'); | ||
|
||
+/** | ||
+ * This condition confirms whether the configuration for the MFE has switched to a JS-based configuration | ||
+ * as previously implemented in frontend-build and frontend-platform. If the environment variable JS_CONFIG_FILEPATH | ||
+ * exists, then an env.config.js(x) file will be copied from the location referenced by the environment variable to the | ||
+ * root directory. Its env variables can be accessed with getConfig(). | ||
+ * | ||
+ * https://github.com/openedx/frontend-build/blob/master/docs/0002-js-environment-config.md | ||
+ * https://github.com/openedx/frontend-platform/blob/master/docs/decisions/0007-javascript-file-configuration.rst | ||
+ */ | ||
+ | ||
+const envConfigPath = process.env.JS_CONFIG_FILEPATH; | ||
+ | ||
+if (envConfigPath) { | ||
+ const envConfigFilename = envConfigPath.slice(envConfigPath.indexOf('env.config')); | ||
+ fs.copyFileSync(envConfigPath, envConfigFilename); | ||
+} | ||
+ | ||
// Add process env vars. Currently used only for setting the PUBLIC_PATH. | ||
dotenv.config({ | ||
path: path.resolve(process.cwd(), '.env'), |