You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, we release our packages with all of the code nested in a dist dir. This is fine except that it means that in order to avoid forcing our users to have really weird/ugly imports that dig down into dist, we need to export all the important names from the main index.
node/ts/webpack all seem to support this newer concept called "subpath exports":
which would allow us to add exports like "./vector" -> "./dist/src/messages/responses/vector". Then our users could do imports like import {CreateVectorIndex} from @gomomento/sdk/vector, with none of the weird dist` stuff.
However, this requires consumers to use moduleResolution of node16 or bundler. These seem to be the preferred / best practice choices for "modern" applications:
Today, we release our packages with all of the code nested in a
dist
dir. This is fine except that it means that in order to avoid forcing our users to have really weird/ugly imports that dig down intodist
, we need to export all the important names from the mainindex
.node/ts/webpack all seem to support this newer concept called "subpath exports":
https://nodejs.org/api/packages.html#packages_subpath_exports
which would allow us to add exports like "./vector" -> "./dist/src/messages/responses/vector". Then our users could do imports like
import {CreateVectorIndex} from
@gomomento/sdk/vector, with none of the weird
dist` stuff.However, this requires consumers to use
moduleResolution
ofnode16
orbundler
. These seem to be the preferred / best practice choices for "modern" applications:https://www.typescriptlang.org/tsconfig#moduleResolution
but they are not the defaults, and thus I am concerned that it is too risky to introduce a change like this in our
1.x
series.We should definitely try to do this whenever we do a 2.0.
The text was updated successfully, but these errors were encountered: