In order to separately export from two different modules, "mui-tiptap" and "mui-tiptap/icons", typically our existing "exports" configuration in package.json would be sufficient. However, it turns out that this only supports importing the non-root module in a TS application if the consuming package that installs mui-tiptap uses moduleResolution of Node16, NodeNext, bundler, etc. but notnode (the default, and the option suggested by TS in their official docs here
https://www.typescriptlang.org/docs/handbook/module-resolution.html#module-resolution-strategies).
As a (semi-hacky) workaround, we define typesVersions so that we can be compatible with node/node10 resolution in consuming packages for our separate "mui-tiptap/icons" module.
In order to separately export from two different modules,
"mui-tiptap"
and"mui-tiptap/icons"
, typically our existing"exports"
configuration in package.json would be sufficient. However, it turns out that this only supports importing the non-root module in a TS application if the consuming package that installs mui-tiptap usesmoduleResolution
ofNode16
,NodeNext
,bundler
, etc. but notnode
(the default, and the option suggested by TS in their official docs here https://www.typescriptlang.org/docs/handbook/module-resolution.html#module-resolution-strategies).As a (semi-hacky) workaround, we define
typesVersions
so that we can be compatible withnode
/node10
resolution in consuming packages for our separate"mui-tiptap/icons"
module.Some resources related to this: