diff --git a/lib/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js b/lib/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js index 73b1bc611..cb17d786c 100644 --- a/lib/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js +++ b/lib/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js @@ -1,5 +1,4 @@ const { Compilation, sources } = require('webpack'); -const dotenv = require('dotenv'); const fs = require('fs'); const path = require('path'); const { @@ -8,19 +7,12 @@ const { } = require('../../../config/data/paragonUtils'); const { injectMetadataIntoDocument, - // getMfeRuntimeConfig, getParagonStylesheetUrls, injectParagonCoreStylesheets, injectParagonThemeVariantStylesheets, } = require('./utils'); const resolvePrivateEnvConfig = require('../../resolvePrivateEnvConfig'); -// Add process env vars. Currently used only for setting the -// server port and the publicPath -dotenv.config({ - path: path.resolve(process.cwd(), '.env.development'), -}); - // Allow private/local overrides of env vars from .env.development for config settings // that you'd like to persist locally during development, without the risk of checking // in temporary modifications to .env.development. @@ -64,14 +56,10 @@ class ParagonWebpackPlugin { * @returns {Object} Metadata about the Paragon and brand theme URLs from configuration. */ async resolveParagonThemeUrlsFromConfig() { - // const mfeRuntimeApiConfig = await getMfeRuntimeConfig(); let envConfig; if (fs.existsSync(envConfigFile)) { envConfig = require(envConfigFile); } - // const paragonThemeUrls = mfeRuntimeApiConfig?.PARAGON_THEME_URLS - // ?? envConfig?.PARAGON_THEME_URLS - // ?? process.env.PARAGON_THEME_URLS; const paragonThemeUrls = envConfig?.PARAGON_THEME_URLS ?? process.env.PARAGON_THEME_URLS; diff --git a/lib/plugins/paragon-webpack-plugin/utils.js b/lib/plugins/paragon-webpack-plugin/utils.js index 10835ca9c..70a667944 100644 --- a/lib/plugins/paragon-webpack-plugin/utils.js +++ b/lib/plugins/paragon-webpack-plugin/utils.js @@ -1,19 +1,5 @@ const { sources } = require('webpack'); const parse5 = require('parse5'); -const axios = require('axios'); - -async function getMfeRuntimeConfig() { - const { - APP_ID, - MFE_CONFIG_API_URL, - } = process.env; - const queryParams = new URLSearchParams({ - mfe: APP_ID, - }); - const url = `${MFE_CONFIG_API_URL}?${queryParams.toString()}`; - const response = await axios.get(url); - return response.data; -} function getDescendantByTag(node, tag) { for (let i = 0; i < node.childNodes?.length; i++) { @@ -292,7 +278,7 @@ function handleVersionSubstitution({ url, wildcardKeyword, localVersion }) { if (!url || !url.includes(wildcardKeyword) || !localVersion) { return url; } - return url.replace(wildcardKeyword, localVersion); + return url.replaceAll(wildcardKeyword, localVersion); } function getParagonStylesheetUrls({ paragonThemeUrls, paragonVersion, brandVersion }) { @@ -381,7 +367,6 @@ function injectParagonThemeVariantStylesheets({ module.exports = { injectMetadataIntoDocument, - getMfeRuntimeConfig, getParagonStylesheetUrls, injectParagonCoreStylesheets, injectParagonThemeVariantStylesheets,