Skip to content

Commit 2d90c7d

Browse files
committed
fix: use tsup for ESM build to resolve ERR_UNSUPPORTED_DIR_IMPORT
1 parent b9a5fc6 commit 2d90c7d

3 files changed

Lines changed: 1857 additions & 1283 deletions

File tree

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS",
55
"main": "lib/cjs/index.js",
66
"typings": "lib/cjs/index.d.ts",
7-
"module": "lib/esm/index.js",
7+
"module": "lib/esm/index.mjs",
88
"exports": {
99
".": {
1010
"types": "./lib/cjs/index.d.ts",
11-
"import": "./lib/esm/index.js",
11+
"import": "./lib/esm/index.mjs",
1212
"require": "./lib/cjs/index.js"
1313
},
1414
"./package.json": "./package.json"
@@ -18,7 +18,7 @@
1818
"postpack": "run-s clean",
1919
"build": "run-s clean && run-p build:*",
2020
"build:cjs": "tsc -p tsconfig.cjs.json",
21-
"build:esm": "tsc -p tsconfig.esm.json",
21+
"build:esm": "tsup src/index.ts --format esm --outDir lib/esm --no-splitting --no-dts",
2222
"test": "jest",
2323
"lint": "eslint . --ext .js,.ts",
2424
"fmt": "eslint . --ext .js,.ts --fix",
@@ -51,6 +51,7 @@
5151
"semantic-release": "^17.4.4",
5252
"ts-jest": "^26.5.3",
5353
"tslint": "^5.11.0",
54+
"tsup": "^8.5.1",
5455
"typescript": "^4.9.5"
5556
},
5657
"dependencies": {

src/util/ip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2727
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2828

29-
import { Buffer } from 'buffer/';
29+
import { Buffer } from 'buffer';
3030

3131
const ipv4Regex = /^(25[0-5]|2[0-4]\d|1\d\d|\d?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|\d?\d)){3}$/;
3232
const ipv6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;

0 commit comments

Comments
 (0)