Skip to content

Commit f8348bf

Browse files
committed
Add tsignores
1 parent 5ab9103 commit f8348bf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/firestore/src/platform/node/grpc_connection.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
* limitations under the License.
1616
*/
1717

18+
// This is a hack fix for Node ES modules to use `require`.
19+
// @ts-ignore To avoid using `allowSyntheticDefaultImports` flag.
20+
import module from 'module';
21+
1822
import {
1923
Metadata,
2024
GrpcObject,
2125
credentials as GrpcCredentials,
2226
ServiceError
2327
} from '@grpc/grpc-js';
24-
import { version as grpcVersion } from '@grpc/grpc-js/package.json';
2528

2629
import { Token } from '../../api/credentials';
2730
import { DatabaseInfo } from '../../core/database_info';
@@ -35,6 +38,12 @@ import { logError, logDebug, logWarn } from '../../util/log';
3538
import { NodeCallback, nodePromise } from '../../util/node_api';
3639
import { Deferred } from '../../util/promise';
3740

41+
// This is a hack fix for Node ES modules to use `require`.
42+
// @ts-ignore To avoid using `--module es2020` flag.
43+
const require = module.createRequire(import.meta.url);
44+
// eslint-disable-next-line @typescript-eslint/no-require-imports
45+
const { version: grpcVersion } = require('@grpc/grpc-js/package.json');
46+
3847
const LOG_TAG = 'Connection';
3948
const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${SDK_VERSION} grpc/${grpcVersion}`;
4049

0 commit comments

Comments
 (0)