diff --git a/patches/@edx+frontend-build+13.0.14.patch b/patches/@edx+frontend-build+13.0.14.patch index 13bf90a..f7cf639 100644 --- a/patches/@edx+frontend-build+13.0.14.patch +++ b/patches/@edx+frontend-build+13.0.14.patch @@ -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'), diff --git a/webpack.prod.config.js b/webpack.prod.config.js deleted file mode 100644 index 13bc600..0000000 --- a/webpack.prod.config.js +++ /dev/null @@ -1,23 +0,0 @@ -const fs = require('fs'); -const { createConfig } = require('@edx/frontend-build'); - -/** 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; } - }); -} - -const config = createConfig('webpack-prod'); - -module.exports = config;