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

Urls Exports Not Defined #120

Closed
mattcroat opened this issue May 30, 2021 · 2 comments · Fixed by #123
Closed

Urls Exports Not Defined #120

mattcroat opened this issue May 30, 2021 · 2 comments · Fixed by #123

Comments

@mattcroat
Copy link
Contributor

mattcroat commented May 30, 2021

I'm using Node v15.2.1.

Using imports from dominos/utils/urls.js throws an error.

import { useInternational, canada, usa } from 'dominos/utils/urls.js'

The solution might be adding the subpath under the package entry points defined in package.json.

Output
node:internal/process/esm_loader:74
internalBinding('errors').triggerUncaughtException(
                          ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './utils/urls.js' is not defined by "exports" in /home/user/dominos/node_modules/dominos/package.json imported from /home/user/dominos/index.js
    at new NodeError (node:internal/errors:277:15)
    at throwExportsNotFound (node:internal/modules/esm/resolve:321:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:546:3)
    at packageResolve (node:internal/modules/esm/resolve:687:14)
    at moduleResolve (node:internal/modules/esm/resolve:739:18)
    at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:853:11)
    at Loader.resolve (node:internal/modules/esm/loader:85:40)
    at Loader.getModuleJob (node:internal/modules/esm/loader:229:28)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:51:40)
    at link (node:internal/modules/esm/module_job:50:36) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
@RIAEvangelist
Copy link
Owner

Did you ever make progress on this?

@RIAEvangelist
Copy link
Owner

This is odd, because exports is only for commonjs node-dominos is ES2017+ ESM and uses export not the old exports method.

export {
    urls as default,
    urls,
    canada,
    usa,
    useInternational
}

robbieaverill added a commit to robbieaverill/node-dominos-pizza-api that referenced this issue Jan 12, 2022
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

Successfully merging a pull request may close this issue.

2 participants