From 7f4e6da8ccdbecef5e76ec1d3df834b5555320a0 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Tue, 7 Mar 2023 20:02:11 -0800 Subject: [PATCH] build: still need BAZEL_BINDIR for webpack_bundle custom rule (#48796) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actually, webpack_bundle doesn't have JS_BINARY__TARGET set since it is a custom build rule.... To handle all the cases I think we have to check for both. 😞 --- .mocharc.js | 2 +- babel.config.jest.js | 2 +- client/build-config/src/paths.ts | 2 +- client/build-config/src/webpack/getCacheConfig.ts | 2 +- jest.config.base.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.mocharc.js b/.mocharc.js index 7659d56b29a..640dfb7b4af 100644 --- a/.mocharc.js +++ b/.mocharc.js @@ -1,4 +1,4 @@ -const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST) +const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_BINDIR || process.env.BAZEL_TEST) const rootDir = IS_BAZEL ? process.cwd() : __dirname module.exports = { diff --git a/babel.config.jest.js b/babel.config.jest.js index 865fa52d2dd..be70b30051d 100644 --- a/babel.config.jest.js +++ b/babel.config.jest.js @@ -8,7 +8,7 @@ const path = require('path') const logger = require('signale') // TODO(bazel): drop when non-bazel removed. -if (!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST)) { +if (!(process.env.JS_BINARY__TARGET || process.env.BAZEL_BINDIR || process.env.BAZEL_TEST)) { throw new Error(__filename + ' is only for use with Bazel') } diff --git a/client/build-config/src/paths.ts b/client/build-config/src/paths.ts index 77988a12c50..846a0bb4f67 100644 --- a/client/build-config/src/paths.ts +++ b/client/build-config/src/paths.ts @@ -3,7 +3,7 @@ import fs from 'fs' import path from 'path' // TODO(bazel): drop when non-bazel removed. -const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST) +const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_BINDIR || process.env.BAZEL_TEST) // NOTE: use fs.realpathSync() in addition to path.resolve() to resolve // symlinks to the real path. This is required for webpack plugins using diff --git a/client/build-config/src/webpack/getCacheConfig.ts b/client/build-config/src/webpack/getCacheConfig.ts index b69872e713a..5b03a6990cf 100644 --- a/client/build-config/src/webpack/getCacheConfig.ts +++ b/client/build-config/src/webpack/getCacheConfig.ts @@ -5,7 +5,7 @@ import webpack from 'webpack' import { ROOT_PATH } from '../paths' // TODO(bazel): drop when non-bazel removed. -const IS_BAZEL = !!process.env.JS_BINARY__TARGET +const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_BINDIR) interface CacheConfigOptions { invalidateCacheFiles?: string[] diff --git a/jest.config.base.js b/jest.config.base.js index ebaa300e840..aca7da18c5b 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -3,7 +3,7 @@ const path = require('path') // TODO(bazel): drop when non-bazel removed. -const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST) +const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_BINDIR || process.env.BAZEL_TEST) const SRC_EXT = IS_BAZEL ? 'js' : 'ts' const rootDir = IS_BAZEL ? process.cwd() : __dirname