Skip to content

Commit 27b0aef

Browse files
committed
Makes esm and cjs build and fixes hexoid problem
1 parent 8ff7162 commit 27b0aef

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@
44
"version": "7.5.5",
55
"author": "Easypost Engineering <[email protected]>",
66
"homepage": "https://easypost.com",
7+
"exports": {
8+
".": {
9+
"import": "./dist/easypost.mjs",
10+
"require": "./dist/easypost.js",
11+
"types": "./types/index.d.ts"
12+
}
13+
},
14+
"main": "./dist/easypost.js",
15+
"module": "./dist/easypost.mjs",
16+
"types": "./types/index.d.ts",
717
"bin": {
818
"easypost": "./repl.js"
919
},
1020
"repository": {
1121
"type": "git",
1222
"url": "git://github.com/easypost/easypost-node.git"
1323
},
14-
"main": "index.js",
15-
"types": "types/index.d.ts",
1624
"license": "MIT",
1725
"engines": {
1826
"node": ">= 16.0"

vite.config.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@ export default defineConfig({
1212
lib: {
1313
entry: path.resolve(__dirname, 'src/easypost.js'),
1414
fileName: 'easypost',
15-
formats: ['cjs'],
15+
formats: ['cjs', 'es'],
1616
},
1717
sourcemap: isDev,
1818
rollupOptions: {
1919
external: [/^node:.*/, /^@?[a-zA-Z\-_]+\/?[a-zA-Z\-_]*$/],
20-
output: {
21-
dir: 'dist',
22-
},
20+
output: [
21+
{
22+
format: 'cjs',
23+
entryFileNames: '[name].js',
24+
},
25+
{
26+
format: 'esm',
27+
entryFileNames: '[name].mjs',
28+
},
29+
],
2330
},
2431
},
2532

0 commit comments

Comments
 (0)