From 4e32d7a2eb39aaebec93330058797b9cfd57b29c Mon Sep 17 00:00:00 2001 From: frederikprijck Date: Sat, 29 Jul 2023 15:37:46 +0200 Subject: [PATCH] fix: add file extension to import path to support Node16 module resolution --- jest.config.ts | 3 +++ lib/index.ts | 2 +- lib/index.umd.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jest.config.ts b/jest.config.ts index 61b4ecf..0b65960 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -11,6 +11,9 @@ const jestConfig: JestConfigWithTsJest = { "default", ["jest-junit", { outputDirectory: "test-results/jest" }], ], + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, coverageReporters: ["lcov", "text", "text-summary"], setupFiles: [], preset: "ts-jest/presets/default-esm", diff --git a/lib/index.ts b/lib/index.ts index 35270e7..c197f92 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,4 +1,4 @@ -import { base64UrlDecode } from "./base64_url_decode"; +import { base64UrlDecode } from "./base64_url_decode.js"; export interface JwtDecodeOptions { header?: boolean; diff --git a/lib/index.umd.ts b/lib/index.umd.ts index 4726b67..dad670b 100644 --- a/lib/index.umd.ts +++ b/lib/index.umd.ts @@ -1 +1 @@ -export { jwtDecode as default } from './index'; +export { jwtDecode as default } from './index.js';