litefs-js
litefs-js copied to clipboard
Add support for Native ESM
importing 'litefs-js/remix' in ESM project ("type": "module" in package.json ) is not working
error TS2307: Cannot find module 'litefs-js/remix' or its corresponding type declarations.
10 import { ensureInstance } from 'litefs-js/remix'
~~~~~~~~~~~~~~~~~
add this to package.json to fix this issue
"name": "litefs-js",
"version": "1.1.2",
"description": "JavaScript utilities for working with LiteFS on Fly.io",
"types": "dist/index.d.ts",
"main": "dist/index.js",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "default": "./dist/index.js"
+ },
+ "./remix": {
+ "types": "./dist/remix.d.ts",
+ "default": "./dist/remix.js"
+ }
+ },
"scripts": {
although the above patch fixed this issue, maybe it is better to add build script to build both dist/esm and dist/cjs each with its own .d.ts files.
I just noticed this! Sorry about that. I think I would like these changes, but I don't have time to make them myself.