multiformats / js-multiaddr

JavaScript implementation of multiaddr
http://multiformats.github.io/js-multiaddr
Other
109 stars 64 forks source link

Reference to non-existent js file from ts #304

Closed dao closed 1 year ago

dao commented 1 year ago

Describe the bug In https://github.com/multiformats/js-multiaddr/blob/master/src/convert.ts I see:

import { getProtocol } from './protocols-table.js'

Stepping out to the directory view, there is no protocols-table.js. There is, however, protocols-table.ts.

p-shahi commented 1 year ago

@maschad will take this on

maschad commented 1 year ago

This is because the build tool (aegir) transpiles ESM from TS when the build is generated, (in the ./dist folder) and relative import paths need full extensions (e.g we have to write import "./foo.js" instead of import "./foo" ). You can see a similar example here or here

For more info see: https://www.typescriptlang.org/docs/handbook/esm-node.html

achingbrain commented 1 year ago

@dao I think this is functioning as expected. Are you seeing an error message or stack trace? If you are, can you please share the stack trace or repro repo.

achingbrain commented 1 year ago

Closing due to lack of response. Please reopen if you can provide the requested information.