Skip to content

Commit

Permalink
fix issues with ES modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-sz committed Sep 26, 2023
1 parent d34b07d commit 97f0bfc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"version": "1.1.0",
"description": "TypeScript library for easy socket upgrades (STARTTLS).",
"type": "module",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "lib/index.js",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
"exports": {
".": {
"import": "./lib/index.js",
"types": "./lib/index.d.ts"
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts"
}
},
"keywords": [
Expand All @@ -23,7 +24,9 @@
],
"scripts": {
"prepare": "npm run build",
"build": "tsc",
"build": "npm run build:cjs && npm run build:esm",
"build:esm": "tsc --module esnext --outDir lib/esm && echo '{\"type\": \"module\"}' > lib/esm/package.json",
"build:cjs": "tsc --module commonjs --outDir lib/cjs && echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json",
"test": "vitest",
"coverage": "vitest --coverage --run"
},
Expand Down
10 changes: 6 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "node",
"esModuleInterop": false,
"declaration": true,
"outDir": "./lib",
"lib": ["ESNext"],
"lib": ["ES2020", "DOM"],
"strict": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*", "src/run.ts"]
"exclude": ["node_modules", "**/__tests__/*"]
}

0 comments on commit 97f0bfc

Please sign in to comment.