RIAEvangelist / node-dominos-pizza-api

This is a node.js wrapper for the dominos pizza apis
MIT License
547 stars 132 forks source link

Urls Exports Not Defined #120

Closed mattcroat closed 2 years ago

mattcroat commented 3 years ago

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 ```sh 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. (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 commented 3 years ago

Did you ever make progress on this?

RIAEvangelist commented 3 years ago

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
}