diff --git a/package.json b/package.json index 8f9c242..8f31242 100644 --- a/package.json +++ b/package.json @@ -5,16 +5,15 @@ "homepage": "https://replicache.dev", "repository": "github:rocicorp/replicache-react", "type": "module", - "main": "out/index.js", - "module": "out/index.mjs", + "module": "out/index.js", + "types": "out/index.d.ts", + "exports": "./out/index.js", "scripts": { "format": "prettier --write 'src/*.{js,jsx,json,ts,tsx,html,css,md}' '*.{cjs,js,jsx,json,ts,tsx,html,css,md}'", "check-format": "prettier --check 'src/*.{js,jsx,json,ts,tsx,html,css,md}' '*.{cjs,js,jsx,json,ts,tsx,html,css,md}'", "check-types": "tsc --noEmit", "lint": "eslint --ext .ts,.tsx,.js,.jsx src/", - "build-cjs": "tsc --module commonjs --outDir out", - "build-esm": "tsc --module ESNext --outDir out && mv out/index.js out/index.mjs", - "build": "npm run build-esm && npm run build-cjs", + "build": "tsc", "prepack": "npm run lint && npm run test && npm run build", "test": "web-test-runner \"src/**/*.test.{jsx,js,ts,tsx}\"", "test:watch": "npm test -- --watch" @@ -48,7 +47,6 @@ }, "files": [ "out/index.js", - "out/index.mjs", "out/index.d.ts" ] } diff --git a/src/index.test.tsx b/src/index.test.tsx index eaf9bcc..2e0d2c1 100644 --- a/src/index.test.tsx +++ b/src/index.test.tsx @@ -4,7 +4,7 @@ import React from 'react'; import {render} from 'react-dom'; import type {JSONValue, ReadTransaction} from 'replicache'; import {Replicache, TEST_LICENSE_KEY, WriteTransaction} from 'replicache'; -import {Subscribable, useSubscribe} from './index'; +import {Subscribable, useSubscribe} from './index.js'; function sleep(ms: number | undefined): Promise { return new Promise(resolve => setTimeout(resolve, ms)); diff --git a/tsconfig.json b/tsconfig.json index 048b2b2..280da9f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,17 +3,17 @@ "jsx": "react", "target": "ES2022", "isolatedModules": true, - + "outDir": "out", + "module": "Node16", "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "esModuleInterop": true, - "declaration": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node", + "moduleResolution": "Node16", "allowJs": true, "lib": ["dom", "esnext"], "skipLibCheck": true