Skip to content

should capnweb support commonjs ?Β #81

@romainPrignon

Description

@romainPrignon

hi πŸ™‚

I just tried to install capnweb on a commonjs project and I got

node:internal/modules/esm/resolve:314
  return new ERR_PACKAGE_PATH_NOT_EXPORTED(
         ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/exp-capnweb/node_modules/capnweb/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:314:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:605:13)
    at resolveExports (node:internal/modules/cjs/loader:638:36)
    at Function._findPath (node:internal/modules/cjs/loader:743:31)
    at node:internal/modules/cjs/loader:1230:27
    at nextResolveSimple (/home/exp-capnweb/node_modules/.pnpm/tsx@4.20.6/node_modules/tsx/dist/register-D46fvsV_.cjs:4:1004)
    at /home/exp-capnweb/node_modules/.pnpm/tsx@4.20.6/node_modules/tsx/dist/register-D46fvsV_.cjs:3:2630
    at /home/exp-capnweb/node_modules/.pnpm/tsx@4.20.6/node_modules/tsx/dist/register-D46fvsV_.cjs:3:1542
    at resolveTsPaths (/home/exp-capnweb/node_modules/.pnpm/tsx@4.20.6/node_modules/tsx/dist/register-D46fvsV_.cjs:4:760)
    at /home/exp-capnweb/node_modules/.pnpm/tsx@4.20.6/node_modules/tsx/dist/register-D46fvsV_.cjs:4:1102 {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v22.13.0

I solved it by adding in my package.json

"type": "module",
  • should capnweb support commonjs as well as esm ?
  • if no, should it be added to the readme somewhere ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    PRs welcomeWe don't plan to work on this, but would be willing to accept a PR implementing it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions