Skip to content

Commit

Permalink
refactor: remove webpack.prod.config now that postinstall script is a…
Browse files Browse the repository at this point in the history
…dded
  • Loading branch information
jsnwesson committed Feb 9, 2024
1 parent 2ad54d9 commit 760051e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
36 changes: 36 additions & 0 deletions patches/@edx+frontend-build+13.0.14.patch
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,39 @@ index 5ce7716..6828971 100644
historyApiFallback: {
index: path.join(PUBLIC_PATH, 'index.html'),
disableDotRule: true,
diff --git a/node_modules/@edx/frontend-build/config/webpack.prod.config.js b/node_modules/@edx/frontend-build/config/webpack.prod.config.js
index 2879dd9..32af231 100644
--- a/node_modules/@edx/frontend-build/config/webpack.prod.config.js
+++ b/node_modules/@edx/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 exists, then
+ * an env.config.js file will be created at the root directory and 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.copyFile(envConfigPath, envConfigFilename, (err) => {
+ if (err) { throw err; }
+ });
+}
+
// Add process env vars. Currently used only for setting the PUBLIC_PATH.
dotenv.config({
path: path.resolve(process.cwd(), '.env'),
23 changes: 0 additions & 23 deletions webpack.prod.config.js

This file was deleted.

0 comments on commit 760051e

Please sign in to comment.