Skip to content

Commit

Permalink
Use ESNext as default module system
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops committed Aug 5, 2023
1 parent 7694b50 commit 0e1998f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 25 deletions.
3 changes: 3 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { base64UrlDecode } from "./base64-url-decode";
import { base64UrlDecode } from "./base64-url-decode.js";

export interface JwtDecodeOptions {
header?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion lib/index.umd.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { jwtDecode as default } from "./index";
export { jwtDecode as default } from "./index.js";
5 changes: 1 addition & 4 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import livereload from "rollup-plugin-livereload";
import serve from "rollup-plugin-serve";

const isProduction = process.env.NODE_ENV === "production";
const tsPlugin = typescript({
rootDir: "lib",
sourceMap: true,
});
const tsPlugin = typescript({ tsconfig: "tsconfig.build.json" });

const plugins = [
tsPlugin,
Expand Down
2 changes: 1 addition & 1 deletion test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jwtDecode, InvalidTokenError, JwtPayload } from "./../lib/index";
import { jwtDecode, InvalidTokenError, JwtPayload } from "./../lib/index.js";
import { describe, expect, it } from "@jest/globals";

const token =
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES2017",
"rootDir": "./lib",
"sourceMap": true
}
}
14 changes: 4 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
{
"compilerOptions": {
"target": "ES2017",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"sourceMap": false,
"moduleResolution": "node",
"noImplicitAny": true,
"downlevelIteration": true,
"noImplicitThis": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"noEmitOnError": true
},
"exclude": ["./test", "./build/typings"]
}
}
9 changes: 1 addition & 8 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noImplicitAny": false,
"target": "es6",
"noImplicitThis": false,
"alwaysStrict": false,
"strictBindCallApply": false,
"strictNullChecks": false,
"strictFunctionTypes": false,
"strictPropertyInitialization": false
"esModuleInterop": true
}
}

0 comments on commit 0e1998f

Please sign in to comment.