get-alex / alex

Catch insensitive, inconsiderate writing
https://alexjs.com
MIT License
4.81k stars 207 forks source link

Add `main` field to `package.json` #342

Closed kanadgupta closed 1 year ago

kanadgupta commented 1 year ago

Hi there! I'm attempting to use the JS API with the latest version (i.e., alex@11.0.0) and I'm seeing the following deprecation warning:

(node:65358) [DEP0151] DeprecationWarning: No "main" or "exports" field defined in the package.json for [redacted]/node_modules/alex/ resolving the main entry point "index.js", imported from [redacted]

Per the docs for DEP0151:

With this deprecation, all ES module main entry point resolutions require an explicit "exports" or "main" entry with the exact file extension.

I figured it was safe to add an exports field that points to the index.js file, similar to the recommended approach in the Node.js docs.

Thanks in advance! Big fan of this project ๐Ÿ™‚

wooorm commented 1 year ago

hey!

AFAIK, this is a warning right, not an actual error? This used to work for 10 years or so.

Using exports is a technically potentially breaking change, so thatโ€™s a little bit hmmm from me. An alternative is adding a main: "index.js". That should also silence the error, and not prevent anything else from being used if desired

kanadgupta commented 1 year ago

Yes, this is more to address a warning than an actual error. Agree with this assessment โ€” I'll make that change. Thanks!

kanadgupta commented 1 year ago

@wooorm okay updated!

wooorm commented 1 year ago

Thanks, released!