qiwi / deep-proxy

Deep proxy implementation for TypeScript
MIT License
9 stars 1 forks source link

Importing from a cjs project throws #82

Closed Ustice closed 2 years ago

Ustice commented 2 years ago

Issue type

Expected behavior

working as expected

Actual behavior

2022-06-20T21:01:49.837Z error (SYSTEM) — uncaughtException: Package subpath './target/bundle/deep-proxy.cjs' is not defined by "exports" in /home/node/app/node_modules/@qiwi/deep-proxy/package.json
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './target/bundle/deep-proxy.cjs' is not defined by "exports" in /home/node/app/node_modules/@qiwi/deep-proxy/package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
    at resolveExports (internal/modules/cjs/loader.js:432:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
    at Function.Module._resolveFilename (/home/node/app/node_modules/module-alias/index.js:49:29)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.@qiwi/deep-proxy/target/bundle/deep-proxy.cjs (/home/node/app/dist/server.js:10359:18) {
  error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './target/bundle/deep-proxy.cjs' is not defined by "exports" in /home/node/app/node_modules/@qiwi/deep-proxy/package.json
      at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
      at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
      at resolveExports (internal/modules/cjs/loader.js:432:36)
      at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
      at Function.Module._resolveFilename (/home/node/app/node_modules/module-alias/index.js:49:29)
      at Function.Module._load (internal/modules/cjs/loader.js:725:27)
      at Module.require (internal/modules/cjs/loader.js:952:19)
      at require (internal/modules/cjs/helpers.js:88:18)
      at Object.@qiwi/deep-proxy/target/bundle/deep-proxy.cjs (/home/node/app/dist/server.js:10359:18) {
    code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
  },
  stack: `Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './target/bundle/deep-proxy.cjs' is not defined by "exports" in /home/node/app/node_modules/@qiwi/deep-proxy/package.json\n` +
    '    at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)\n' +
    '    at packageExportsResolve (internal/modules/esm/resolve.js:513:3)\n' +
    '    at resolveExports (internal/modules/cjs/loader.js:432:36)\n' +
    '    at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)\n' +
    '    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)\n' +
    '    at Function.Module._resolveFilename (/home/node/app/node_modules/module-alias/index.js:49:29)\n' +
    '    at Function.Module._load (internal/modules/cjs/loader.js:725:27)\n' +
    '    at Module.require (internal/modules/cjs/loader.js:952:19)\n' +
    '    at require (internal/modules/cjs/helpers.js:88:18)\n' +
    '    at Object.@qiwi/deep-proxy/target/bundle/deep-proxy.cjs (/home/node/app/dist/server.js:10359:18)',
  exception: true,
  date: 'Mon Jun 20 2022 21:01:49 GMT+0000 (Coordinated Universal Time)',
  process: {
    pid: 53,
    uid: 1000,
    gid: 1000,
    cwd: '/home/node/app',
    execPath: '/usr/local/bin/node',
    version: 'v14.16.1',
    argv: [ '/usr/local/bin/node', '/home/node/app/dist/server.js' ],
    memoryUsage: {
      rss: 147566592,
      heapTotal: 102432768,
      heapUsed: 79763800,
      external: 7682841,
      arrayBuffers: 246197
    }
  },
  os: { loadavg: [ 1.3, 0.42, 2.14 ], uptime: 16488 },
  trace: [
    {
      column: 9,
      file: 'internal/modules/esm/resolve.js',
      function: 'throwExportsNotFound',
      line: 290,
      method: null,
      native: false
    },
    {
      column: 3,
      file: 'internal/modules/esm/resolve.js',
      function: 'packageExportsResolve',
      line: 513,
      method: null,
      native: false
    },
    {
      column: 36,
      file: 'internal/modules/cjs/loader.js',
      function: 'resolveExports',
      line: 432,
      method: null,
      native: false
    },
    {
      column: 31,
      file: 'internal/modules/cjs/loader.js',
      function: 'Module._findPath',
      line: 472,
      method: '_findPath',
      native: false
    },
    {
      column: 27,
      file: 'internal/modules/cjs/loader.js',
      function: 'Module._resolveFilename',
      line: 867,
      method: '_resolveFilename',
      native: false
    },
    {
      column: 29,
      file: '/home/node/app/node_modules/module-alias/index.js',
      function: 'Module._resolveFilename',
      line: 49,
      method: '_resolveFilename',
      native: false
    },
    {
      column: 27,
      file: 'internal/modules/cjs/loader.js',
      function: 'Module._load',
      line: 725,
      method: '_load',
      native: false
    },
    {
      column: 19,
      file: 'internal/modules/cjs/loader.js',
      function: 'Module.require',
      line: 952,
      method: 'require',
      native: false
    },
    {
      column: 18,
      file: 'internal/modules/cjs/helpers.js',
      function: 'require',
      line: 88,
      method: null,
      native: false
    },
    {
      column: 18,
      file: '/home/node/app/dist/server.js',
      function: 'Object.@qiwi/deep-proxy/target/bundle/deep-proxy.cjs',
      line: 10359,
      method: 'cjs',
      native: false
    }
  ]
}

Steps to reproduce

Sorry, I don't have time at the moment. It should be any cjs typescript project.

Specifications

antongolub commented 2 years ago

@Ustice,

Nice catch, thanks.

qiwibot commented 2 years ago

:tada: This issue has been resolved in version 2.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: