Repository navigation
Conversation
| "types": "./dist/fuse.d.ts", | ||
| "import": "./dist/fuse.esm.js", | ||
| "require": "./dist/fuse.common.js" |
There was a problem hiding this comment.
| "types": "./dist/fuse.d.ts", | |
| "import": "./dist/fuse.esm.js", | |
| "require": "./dist/fuse.common.js" | |
| "import": { | |
| "types": "./dist/fuse.d.ts", | |
| "default": "./dist/fuse.esm.js" | |
| }, | |
| "require": { | |
| "types": "./dist/fuse.d.ts", | |
| "default": "./dist/fuse.common.js" | |
| } |
|
This would be something that would help us. Is there something I can do to help here on this effort ? |
|
@rchandu seems like there hasn't been active development in this repo for a couple of months now 🤔 |
| "type": "module", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/fuse.d.ts", | ||
| "import": "./dist/fuse.esm.js", | ||
| "require": "./dist/fuse.common.js" | ||
| } | ||
| }, |
There was a problem hiding this comment.
| "type": "module", | |
| "exports": { | |
| ".": { | |
| "types": "./dist/fuse.d.ts", | |
| "import": "./dist/fuse.esm.js", | |
| "require": "./dist/fuse.common.js" | |
| } | |
| }, | |
| "exports": { | |
| "types": "./dist/fuse.d.ts", | |
| "import": "./dist/fuse.esm.js", | |
| "require": "./dist/fuse.common.js" | |
| }, |
The old version was invalid. You cannot just add "type": "module" unless Fuse itself is rewritten to ESM. Also "type": "module" only affects the module itself, not when the module is loaded through node_modules.
Furthermore the subgrouping of "." is not necessary because Fuse doesn't have subpath exports
Lastly, after including this change thus reverting "type": "module" you should also revert the other .cjs related changes.
There was a problem hiding this comment.
Thanks for reviewing! I have updated to your suggestions.
It's been a while and I haven't checked again, locally, but I hope this would work well with Typescript + Jest
There was a problem hiding this comment.
It should. I maintain the Sapphire project and we use this structure in all projects there are it works with a variety of stacks. CJS, ESM, Jest, Vitest, etc
|
@krisk Could you kindly please take a look at this? Thanks! |
|
@akphi expect a PR to your fork with a completely refreshed but also thoroughly tested setup very soon, when you merge that it'll pop up here for Krisk to then review fully. I noticed my comment above introduced some other issues as well but now I am testing the scenarios:
Edit: Only having some trouble with the last one still so I need to figure that out. |
|
hey @favna, thanks for being super transparent; I really don't mind you carrying that out; all I need is just to have ESM ready :) Thanks so much for the help! - let me know, I'll close it out in favor of your PR |
@krisk We're using
Typescriptmodule: Node16in our project and sinceFuse.jsESM does not specifytype: moduleandexportsfield inpackage.json, it does not get picked up properly by Typescript. So I would like to add these to thepackage.jsonfile.The error I got is something like this, for the following import:
I believe this would help with #541 as I have noted there
For Typescript esm mode, such as
Node16,NodeNext,esModuleInteropis not supported in this mode, it's worth if we do something like lukeed/clsx#44 - I have given it an attempt but not quite sure how I can modify thed.tsfile accordingly.