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

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/style.css' is not defined by "exports" #574

Open
LinKassem opened this issue Mar 14, 2023 · 2 comments

Comments

@LinKassem
Copy link

Hi,

I am getting this eslint error with the latest version of this package:

Oops! Something went wrong! :(

ESLint: 7.32.0

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/style.css' is not defined by "exports" in /{my workspace dir}/node_modules/allotment/package.json
Occurred while linting /{my workspace dir}/src/pages/{my js file}.js:36
    at new NodeError (node:internal/errors:399:5)
    at exportsNotFound (node:internal/modules/esm/resolve:361:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:697:9)
    at resolveExports (node:internal/modules/cjs/loader:565:36)
    at Module._findPath (node:internal/modules/cjs/loader:634:31)
    at findModulePath (/{my workspace dir}/node_modules/eslint-import-resolver-alias/index.js:99:27)
    at exports.resolve (/{my workspace dir}/node_modules/eslint-import-resolver-alias/index.js:75:10)
    at v2 (/{my workspace dir}/node_modules/eslint-module-utils/resolve.js:116:23)
    at withResolver (/{my workspace dir}/node_modules/eslint-module-utils/resolve.js:121:14)
    at fullResolve (/{my workspace dir}/node_modules/eslint-module-utils/resolve.js:138:22)

Any idea how to fix this? Thanks

@johnwalley
Copy link
Owner

Hi @LinKassem. Could you provide some more information about your build environment? Or if it's an eslint error what the rule is?

This is what I currently provide for the exports field:

Screenshot 2023-04-26 at 22 17 46

which I expect to capture paths like allotment/dist/style.css.

@napmn
Copy link

napmn commented Jun 6, 2023

Hey! I have the same problem. To provide more context: I've only started to see this error after i started using eslint-import-resolver-alias package with configuration to enable absolute paths.

With node version 16 I got "Deprecation warning" that folder mapping ./dist/ will be deprecated and pattern ./dist/* should be used in package.json file of allotment package.

After i switch to node 18 I got the same error as @LinKassem. When manually changing the pattern in node_modules/allotment/package.json from ./dist/ to ./dist/* im no longer getting this error.

Can i open a PR resolving this issue or do you see any complications @johnwalley ?

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