From b89ef4bfbbdfd8b6f7acc3844d9ac9a5c17e1925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20L=C3=BCder?= Date: Tue, 18 Feb 2025 10:37:57 -0600 Subject: [PATCH] fix: add REACT_18 env variable to kbn-plugin-helpers bazel config (#211121) ## Summary Adds `REACT_18` to `kbn-plugin-helpers` bazel config, this fixes an issue when trying to create plugins using the automatic plugin generator. For context see https://github.com/elastic/kibana/pull/210917#issuecomment-2657805726 Related user report: [Custom Plugin Error](https://discuss.elastic.co/t/custom-plugin-error/366589) Before fix: ![image](https://github.com/user-attachments/assets/e7e9e524-719e-4fdb-8598-050ec9f2f036) After fix: ![image](https://github.com/user-attachments/assets/63d69d1a-bfc8-4be6-83a0-1c567be4d101) ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) Co-authored-by: Jon (cherry picked from commit 9a6a349a466d4c21bd8d94b7be67996c102dbd5b) --- packages/kbn-plugin-helpers/src/tasks/bazel_packages.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/kbn-plugin-helpers/src/tasks/bazel_packages.ts b/packages/kbn-plugin-helpers/src/tasks/bazel_packages.ts index c7a6ad85bab1f..08f82e497f45a 100644 --- a/packages/kbn-plugin-helpers/src/tasks/bazel_packages.ts +++ b/packages/kbn-plugin-helpers/src/tasks/bazel_packages.ts @@ -13,6 +13,8 @@ import { TaskContext } from '../task_context'; export async function buildBazelPackages({ log, dist }: TaskContext) { log.info('run bazel and build required artifacts for the optimizer'); + const args = [`--define=REACT_18=${Boolean(process.env.REACT_18)}`]; + if (dist) args.push('--define=dist=true'); try { await runBazel( [ @@ -21,7 +23,7 @@ export async function buildBazelPackages({ log, dist }: TaskContext) { '//src/platform/packages/private/kbn-ui-shared-deps-src:shared_built_assets', '//src/platform/packages/shared/kbn-monaco:target_workers', '--show_result=1', - ].concat(dist ? [`--define=dist=true`] : []), + ].concat(args), { logPrefix: ' │ ', quiet: true,