diff --git a/package.json b/package.json index acbb86a..601449d 100644 --- a/package.json +++ b/package.json @@ -2,18 +2,20 @@ "name": "@aboutbits/react-ui-integrations", "version": "1.0.0", "description": "Webpack and Tailwind integration for ReactUI", - "main": "dist/index.js", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "types": "dist/cjs/index.d.ts", "engines": { "node": "^16", "npm": "^8" }, "scripts": { - "build": "npm run build:node && npm run build:esm", - "build:node": "tsc", - "build:esm": "tsc --project tsconfig.esnext.json", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --project tsconfig.build.cjs.json", + "build:esm": "tsc --project tsconfig.build.esm.json", "lint": "eslint --ext js,ts,tsx src", "lint:fix": "npm run lint -- --fix", - "typecheck": "tsc --noEmit", + "typecheck": "tsc --project tsconfig.build.esm.json --noEmit", "test": "jest --verbose --passWithNoTests", "prepare": "npm run build", "prepublishOnly": "npm run test && npm run lint", @@ -46,14 +48,15 @@ "peerDependencies": { "@aboutbits/react-ui": "~0.1.0 || ~0.2.0 || ~0.3.0 || ~1.0.0", "next": "^12", + "react": "^17", "tailwindcss": "^3.1", "webpack": "^5" }, "devDependencies": { "@types/jest": "^28.1.3", "@types/lodash.mergewith": "^4.6.7", - "@types/react": "^18.0.14", - "@types/react-dom": "^18.0.5", + "@types/react": "^17.0.0", + "@types/react-dom": "^17.0.0", "@typescript-eslint/eslint-plugin": "^5.30.0", "@typescript-eslint/parser": "^5.30.0", "eslint": "^8.18.0", diff --git a/tsconfig.build.cjs.json b/tsconfig.build.cjs.json new file mode 100644 index 0000000..e12f94b --- /dev/null +++ b/tsconfig.build.cjs.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "strict": true, + "target": "ES5", + "esModuleInterop": true, + "moduleResolution": "node", + "outDir": "./dist/cjs", + "declaration": true, + "importHelpers": true + }, + "exclude": ["**/__test__/*", "**/__tests__/*"], + "include": ["src"] +} diff --git a/tsconfig.build.esm.json b/tsconfig.build.esm.json new file mode 100644 index 0000000..eacbe88 --- /dev/null +++ b/tsconfig.build.esm.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "strict": true, + "target": "ES6", + "esModuleInterop": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "outDir": "./dist/esm", + "declaration": true, + "importHelpers": true + }, + "exclude": ["**/__test__/*", "**/__tests__/*"], + "include": ["src"] +} diff --git a/tsconfig.esnext.json b/tsconfig.esnext.json deleted file mode 100644 index eba3b3b..0000000 --- a/tsconfig.esnext.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "module": "esnext", - "target": "es5", - "moduleResolution": "Node", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "outDir": "./dist/esm", - "declaration": true, - "strict": true, - "skipLibCheck": true - }, - "include": ["src"], - "exclude": ["node_modules", "**/__test__/*", "**/__tests__/*"] -} diff --git a/tsconfig.json b/tsconfig.json index 0165798..2f98042 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,5 @@ { "compilerOptions": { - "target": "es5", - "esModuleInterop": true, - "outDir": "./dist", - "declaration": true, - "strict": true, - "sourceMap": true, - "skipLibCheck": true - }, - "include": ["src"], - "exclude": ["node_modules", "**/__test__/*", "**/__tests__/*"] + "esModuleInterop": true + } }