jo3-l / obscenity

Robust, extensible profanity filter for NodeJS
MIT License
82 stars 5 forks source link

Fix Typescript Types when using NodeNext module resolution #44

Closed cevr closed 11 months ago

cevr commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch obscenity@0.1.4 for the project I'm working on.

Using NodeNext as the typescript moduleResolution causes the types to be unresolved.

Here is the diff that solved my problem:

diff --git a/node_modules/obscenity/package.json b/node_modules/obscenity/package.json
index 899188c..580449a 100644
--- a/node_modules/obscenity/package.json
+++ b/node_modules/obscenity/package.json
@@ -6,8 +6,14 @@
   "module": "./dist/index.mjs",
   "types": "./dist/index.d.ts",
   "exports": {
-    "import": "./dist/index.mjs",
-    "require": "./dist/index.js"
+    "import": {
+      "types": "./dist/index.d.ts",
+      "default":"./dist/index.mjs"
+    },
+    "require": {
+      "types": "./dist/index.d.ts",
+      "default": "./dist/index.js"
+    }
   },
   "repository": {
     "type": "git",

This issue body was partially generated by patch-package.

jo3-l commented 11 months ago

Thanks for the report; I applied your patch verbatim and it should be available in the newest version of Obscenity. Apologies for the long turnaround.