allotment icon indicating copy to clipboard operation
allotment copied to clipboard

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

Open LinKassem opened this issue 1 year ago • 2 comments

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

LinKassem avatar Mar 14 '23 10:03 LinKassem

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.

johnwalley avatar Apr 26 '23 21:04 johnwalley

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 ?

napmn avatar Jun 06 '23 13:06 napmn