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

The "exports" field in package.json is a breaking change in 2.4.5 #49

Closed
hongxuWei opened this issue Jul 16, 2024 · 3 comments · Fixed by #50
Closed

The "exports" field in package.json is a breaking change in 2.4.5 #49

hongxuWei opened this issue Jul 16, 2024 · 3 comments · Fixed by #50

Comments

@hongxuWei
Copy link

Reproduce:

npm i file-system-cache
// filename: index.js
const fsc = require('file-system-cache');
node index.js

got a error

node:internal/modules/cjs/loader:599
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /test/node_modules/file-system-cache/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:304:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:594:13)
    at resolveExports (node:internal/modules/cjs/loader:592:36)
    at Module._findPath (node:internal/modules/cjs/loader:669:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1131:27)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/test/index.js:1:13)
    at Module._compile (node:internal/modules/cjs/loader:1358:14) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
@hongxuWei hongxuWei changed the title The "exports" field in package.json is a breaking change The "exports" field in package.json is a breaking change in 2.4.5 Jul 16, 2024
@philcockfield
Copy link
Owner

philcockfield commented Jul 16, 2024

Thanks @hongxuWei

I guess I should re-release this on a major version - as the library has moved to ESM only, following Storybook's lead (as per @ndelangen's PR #47).

If you'd like to keep using require, you can version lock to 2.4.4.

@philcockfield
Copy link
Owner

philcockfield commented Jul 16, 2024

UPDATE: new patch version 2.4.7 has been reverted to the prior working CommonJS version so that any projects that still support require don't break on the 2.4 version.

3.0.0 version for the breaking ESM release (published now)

@ndelangen
Copy link
Contributor

Thank you @philcockfield

Sorry if i wasn't clear that merging my PR would require a major version bump!

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