Skip to content

Commit b260614

Browse files
committed
Add createRequire
1 parent accb553 commit b260614

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
* limitations under the License.
1616
*/
1717

18+
import module from 'module';
19+
1820
import {
1921
Metadata,
2022
GrpcObject,
2123
credentials as GrpcCredentials,
2224
ServiceError
2325
} from '@grpc/grpc-js';
24-
import { version as grpcVersion } from '@grpc/grpc-js/package.json';
2526

2627
import { Token } from '../../api/credentials';
2728
import { DatabaseInfo } from '../../core/database_info';
@@ -35,6 +36,11 @@ import { logError, logDebug, logWarn } from '../../util/log';
3536
import { NodeCallback, nodePromise } from '../../util/node_api';
3637
import { Deferred } from '../../util/promise';
3738

39+
const require = module.createRequire(import.meta.url);
40+
41+
// eslint-disable-next-line @typescript-eslint/no-require-imports
42+
const { version: grpcVersion } = require('@grpc/grpc-js/package.json');
43+
3844
const LOG_TAG = 'Connection';
3945
const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${SDK_VERSION} grpc/${grpcVersion}`;
4046

packages/firestore/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"extends": "../../config/tsconfig.base.json",
33
"compilerOptions": {
4-
"outDir": "dist"
4+
"outDir": "dist",
5+
"allowSyntheticDefaultImports": true,
6+
"module": "es2020"
57
},
68
"exclude": [
79
"scripts/**/*",

0 commit comments

Comments
 (0)