From 192a58ab518de9322b5a8f9f0f52e4692ca16f5f Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Fri, 24 Sep 2021 10:09:17 -0400 Subject: [PATCH] fix: hardcode the newrelic agent, to load it earlier (#652) This is a test, before making a more proper fix in frontend-build. But I'd like to confirm this fixes some issues we've seen with newrelic metrics. AA-1015 --- public/index.html | 10 ++++++++++ webpack.prod.config.js | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 webpack.prod.config.js diff --git a/public/index.html b/public/index.html index 25011915..76071ce7 100644 --- a/public/index.html +++ b/public/index.html @@ -5,6 +5,16 @@ + + <% if (process.env.NEW_RELIC_ACCOUNT_ID) { %> + + <% } %> + <% if (htmlWebpackPlugin.options.OPTIMIZELY_PROJECT_ID) { %> <% } %> diff --git a/webpack.prod.config.js b/webpack.prod.config.js new file mode 100644 index 00000000..b91fa479 --- /dev/null +++ b/webpack.prod.config.js @@ -0,0 +1,18 @@ +const { getBaseConfig } = require('@edx/frontend-build'); + +const config = getBaseConfig('webpack-prod'); + +// Filter plugins in the preset config that we don't want +function filterPlugins(plugins) { + const pluginsToRemove = [ + 'a', // "a" is the constructor name of HtmlWebpackNewRelicPlugin + ]; + return plugins.filter(plugin => { + const pluginName = plugin.constructor && plugin.constructor.name; + return !pluginsToRemove.includes(pluginName); + }); +} + +config.plugins = filterPlugins(config.plugins); + +module.exports = config;