From caefab0a03ce4e000e55df0cc9495df92632085c Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 23 Apr 2020 15:37:05 -0700 Subject: [PATCH] feat: export fallback from fallback (circular) (#803) --- src/fallback.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/fallback.ts b/src/fallback.ts index 8ebe33e0e..7e3eccb51 100644 --- a/src/fallback.ts +++ b/src/fallback.ts @@ -413,3 +413,13 @@ export function createApiCall( } export {protobuf}; + +// Different environments or bundlers may or may not respect "browser" field +// in package.json (e.g. Electron does not respect it, but if you run the code +// through webpack first, it will follow the "browser" field). +// To make it safer and more compatible, let's make sure that if you do +// const gax = require("google-gax"); +// you can always ask for gax.fallback, regardless of "browser" field being +// understood or not. +const fallback = module.exports; +export {fallback};