Skip to content

Commit d9c92ea

Browse files
authored
Merge pull request #132 from MTroian94/master
Add ESM build output and improve package exports for better module compatibility
2 parents b5db4c1 + 70bb8eb commit d9c92ea

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "3.8.16",
44
"description": "A Next.js Top Loading Bar component made using nprogress, works with Next.js 15 and Next.js 14 and React.",
55
"main": "dist/index.js",
6+
"module": "dist/index.mjs",
67
"types": "dist/index.d.ts",
78
"scripts": {
89
"build-lib": "tsup",
@@ -11,9 +12,21 @@
1112
"typecheck": "tsc -p tsconfig.json"
1213
},
1314
"exports": {
14-
".": "./dist/index.js",
15-
"./app": "./dist/app.js",
16-
"./pages": "./dist/pages.js"
15+
".": {
16+
"import": "./dist/index.mjs",
17+
"require": "./dist/index.js",
18+
"types": "./dist/index.d.ts"
19+
},
20+
"./app": {
21+
"import": "./dist/app.mjs",
22+
"require": "./dist/app.js",
23+
"types": "./dist/app.d.ts"
24+
},
25+
"./pages": {
26+
"import": "./dist/pages.mjs",
27+
"require": "./dist/pages.js",
28+
"types": "./dist/pages.d.ts"
29+
}
1730
},
1831
"funding": {
1932
"url": "https://buymeacoffee.com/thesgj"

tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export const tsup: Options = {
77
keepNames: true,
88
sourcemap: true,
99
minify: true,
10-
format: ['cjs'],
10+
format: ['cjs', 'esm'],
1111
};

0 commit comments

Comments
 (0)