Skip to content

Commit

Permalink
Hotfix: Create tsup config and move esm output
Browse files Browse the repository at this point in the history
  • Loading branch information
shkreios committed Feb 22, 2023
1 parent a72b27f commit bd7aa5c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-dolls-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-hook-form-subscribe': patch
---

Temporarily move esm output to a non-.mjs file due to react-use-event-hook not providing esm output
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"node": true,
"es6": true
},
"ignorePatterns": ["node_modules/*", "dist/*", "vitest.config.ts"],
"ignorePatterns": ["node_modules/*", "dist/*", "vitest.config.ts", "tsup.config.ts"],
"rules": {
"@typescript-eslint/ban-ts-comment": "warn",
"prettier/prettier": ["error", {}, { "usePrettierrc": true }],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"license": "MIT",
"version": "0.1.0",
"main": "dist/index.js",
"module": "dist/index.mjs",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"description": "Imperative subscribe hook for RHF fields",
"files": [
Expand All @@ -24,7 +24,7 @@
},
"homepage": "https://github.com/shkreios/react-hook-form-subscribe#readme",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"build": "tsup",
"tsc": "tsc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
Expand Down
17 changes: 17 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entryPoints: ['src/index.ts'],
format: ['esm', 'cjs'],
dts: true,
external: ['react'],

treeshake: true,
sourcemap: true,
clean: true,
splitting: true,

outExtension: ({ format }) => ({
js: format === 'cjs' ? '.js' : `.${format}.js`,
}),
});

0 comments on commit bd7aa5c

Please sign in to comment.