Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No "exports" main defined when upgrading to v3.0.0 #52

Open
conorfuller opened this issue Jul 22, 2024 · 5 comments
Open

No "exports" main defined when upgrading to v3.0.0 #52

conorfuller opened this issue Jul 22, 2024 · 5 comments

Comments

@conorfuller
Copy link

Hello!

First and foremost, thank you for the awesome library - we've been using it for a few weeks now and are very impressed with the results. We attempted to upgrade to the latest 3.0.0 version today however, and we're now getting:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/conorfu/....../node_modules/file-system-cache/package.json [Storefront Client] at new NodeError (node:internal/errors:405:5) [Storefront Client] at exportsNotFound (node:internal/modules/esm/resolve:259:10) [Storefront Client] at packageExportsResolve (node:internal/modules/esm/resolve:533:13)

This is a Node 20/Next 14 based application and we are using a commonjs environment and am unable to switch easily to use ESM. Is it possible to add default exports to the package.json for increased module support? As has been done here for next/auth nextauthjs/next-auth@b1a8102

@conorfuller
Copy link
Author

Our very basic usage in the code if it helps:

`import Cache from 'file-system-cache';

const cache = Cache({ basePath: './.images', ttl: configuration.IMAGES_CACHE_TTL });`

@gitSambhal
Copy link

@conorfuller use version 2.4.7.

npm i file-system-cache@^2.4.7

@conorfuller
Copy link
Author

Thanks @gitSambhal, unfortunately we have a strict security policy that all versions must be on the latest available so rolling back isn't an option for us.

@gitSambhal
Copy link

@conorfuller not sure about your usecase but I am using https://github.com/maxpert/node-cache-manager-sqlite, you can try that.

@philcockfield
Copy link
Owner

philcockfield commented Jul 24, 2024

Hi there @conorfuller - thanks for the issue report, and @gitSambhal

Yes, locking to 2.4.4 version is the solution here UNLESS this is all gonna be such a PITA for the upstream projects that we need to rethink going to ESM. But this is not the future, and so I am reluctant.

Here is some context (strong personal opinions lightly held 😄):

This change came in due to a PR (submitted by one of the core Storybook team) updating the project to only support ESM bundling.

I published this change to a major v3 (as it is a breaking change) and on the whole feel we as an entire JS community should be moving to proper ESM support and ditching CJS. Node itself has been frustratingly slow in forcing this issue, and to it's detriment, as the world starts moving away from node itself because of things like this.

Major libraries started doing this a few years ago, the standard itself being ~10 years old. Back then it was a total PITA for me for me when major libraries started doing this, so I do feel the pain.


This is a Node 20/Next 14 based application and we are using a commonjs environment and am unable to switch easily to use ESM. Is it possible to add default exports to the package.json for increased module support? As has been done here for next/auth nextauthjs/next-auth@b1a8102

That's super helpful @conorfuller - lemme figure that out, and see if I can get that into a release for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants