ipfs-shipyard / ignite-metrics

Metrics consent and client provider library for ipfs/ipfs-gui team (i.e. IPFS Ignite). See ipfs/ipfs-gui#129 for more details
Other
4 stars 3 forks source link

fix: node-next and the weird case of importing ts code from js files #52

Closed whizzzkid closed 1 year ago

whizzzkid commented 1 year ago

In this PR:

SgtPooki commented 1 year ago

While I would like to be able to import foo from './myTypescript.ts' instead of import foo from './myTypescript.js', I do not believe this is "fixing" anything in this repo. Please let me know if I'm missing something, but this is changing things further from the patterns already set for a majority of the js-ipfs projects.

Many of the comments in the linked issue seem to be about deno and interop support, or migrating of existing projects.. but things are already working in this repo when building, and when imported into ESM projects.

What is this fixing? what was broken?

SgtPooki commented 1 year ago

when I add the extension to config.js in MetricsProvider, it resolves the config file fine, but still can't resolve the countly-web-sdk dependency (same error with https://github.com/ipfs/ipfs-companion/pull/1117):

Run `npm audit` for details.

  lib/ipfs-companion.js
    init
      1) should query local storage for options with hardcoded defaults for fallback

  0 passing (857ms)
  1 failing

  1) lib/ipfs-companion.js
       init
         should query local storage for options with hardcoded defaults for fallback:
     TypeError: Cannot read properties of undefined (reading 'init')
      at new MetricsProvider (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/ipfs-companion/node_modules/@ipfs-shipyard/ignite-metrics/dist/src/MetricsProvider.js:14:29)
      at getMetricsProviderInstance (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/ipfs-companion/add-on/src/lib/telemetry.js:9:40)
      at startSession (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/ipfs-companion/add-on/src/lib/telemetry.js:67:42)
      at Module.init (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/ipfs-companion/add-on/src/lib/ipfs-companion.js:62:7)
      at async Context.<anonymous> (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/ipfs-companion/test/functional/lib/ipfs-companion.test.js:37:29)
SgtPooki commented 1 year ago

discussion held in ipfs-gui-dev chat at https://filecoinproject.slack.com/archives/C03KQ8MC62Y/p1674001285847779. Closing