From 42db9b5529103b785c80baa2119b9d89d2ca1dbd Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 22 Sep 2023 17:05:52 -0700 Subject: [PATCH] Update optimizer webpack config to support ReactFlow dependency (#4882) (#5094) * Add reactflow with compiler fix * Update CHANGELOG * Update comment * Revert adding reactflow dep --------- (cherry picked from commit eec3ed789fa160d5cb68cb32c8c41f4c5fbde1a7) Signed-off-by: Tyler Ohlsen Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] Co-authored-by: Miki --- .../osd-optimizer/src/worker/webpack.config.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/osd-optimizer/src/worker/webpack.config.ts b/packages/osd-optimizer/src/worker/webpack.config.ts index 6adfc1d6d90a..cfe79b4b19a1 100644 --- a/packages/osd-optimizer/src/worker/webpack.config.ts +++ b/packages/osd-optimizer/src/worker/webpack.config.ts @@ -235,6 +235,21 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker: }, }, }, + { + test: /\.js$/, + /* reactflow and some of its dependencies don't have es5 builds + * so we need to build from source and transpile for webpack v4 + */ + include: /node_modules[\\/]@?reactflow/, + use: { + loader: 'babel-loader', + options: { + babelrc: false, + envName: worker.dist ? 'production' : 'development', + presets: [BABEL_PRESET_PATH], + }, + }, + }, { test: /\.(html|md|txt|tmpl)$/, use: {