Skip to content

Commit

Permalink
Add createRequire
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed Sep 29, 2021
1 parent accb553 commit b260614
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/firestore/src/platform/node/grpc_connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
* limitations under the License.
*/

import module from 'module';

import {
Metadata,
GrpcObject,
credentials as GrpcCredentials,
ServiceError
} from '@grpc/grpc-js';
import { version as grpcVersion } from '@grpc/grpc-js/package.json';

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

const require = module.createRequire(import.meta.url);

// eslint-disable-next-line @typescript-eslint/no-require-imports
const { version: grpcVersion } = require('@grpc/grpc-js/package.json');

const LOG_TAG = 'Connection';
const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${SDK_VERSION} grpc/${grpcVersion}`;

Expand Down
4 changes: 3 additions & 1 deletion packages/firestore/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "../../config/tsconfig.base.json",
"compilerOptions": {
"outDir": "dist"
"outDir": "dist",
"allowSyntheticDefaultImports": true,
"module": "es2020"
},
"exclude": [
"scripts/**/*",
Expand Down

0 comments on commit b260614

Please sign in to comment.