Closed raimund-schluessler closed 2 years ago
I just saw that you closed a similar PR saying main is not for ES modules.. While this might be true, I think it still makes sense to include this keyword here. For your other packages where index.js
is in the root folder, npm
simply defaults to index.js
if main
is not set and everything just works. I think it is alright to have the same behavior here. This would help everyone using this module and prevent you from getting the same issues and PRs all over :wink:. And a single legacy line to make the package work seems acceptable for me.
It defines exports
, which is a replacement for main
.
The problem is with your bundler/build tool, not this package.
Having this issue in end of 2022 with the latest tools available, can we reopen this ? Why would this be a problem to add the main as a fallback ?
If omitted,
main
defaults toindex.js
, see https://docs.npmjs.com/cli/v8/configuring-npm/package-json/#main.Since
index.js
resides indist
for this repo, omitting themain
keyword will make the import fail. This is causing the problems described in https://github.com/sindresorhus/p-queue/issues/145#issuecomment-851873084. With this keyword properly set, importing withinstead of
works again.
cc @skjnldsv @artonge since you had issues with this in https://github.com/nextcloud/server/pull/28127#discussion_r676407842