I'm currently experimenting with using tsup
within a Turborepo to build a package for publishing. This package has wagmi
as a peerDependency
, and wagmi
is an ESM requiring input
. The package.json
for the package is:
{
"name": "...",
"version": "0.0.0",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"license": "MIT",
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",
"dev": "tsup --watch",
"lint": "TIMING=1 eslint \"**/*.ts*\"",
"typecheck": "tsc --noEmit"
},
"private": true,
"dependencies": {
"d3-format": "^3.1.0"
},
"peerDependencies": {
"@tanstack/react-query": "^5.32.1",
"@tanstack/react-query-devtools": "^5.32.1",
"viem": "^2.9.32",
"wagmi": "^2.8.1",
"react": "^18.2.0"
},
"devDependencies": {
"@types/d3-format": "^3.0.4",
"eslint": "^8.54.0",
"eslint-config-custom": "*",
"ts-config": "*",
"tsup": "^8.0.2",
"typescript": "^5.4.5"
}
}
Additionally, the config for tsup
is:
import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['./index.ts'],
format: ['cjs', 'esm'],
external: ['react'],
dts: true,
sourcemap: true,
});
I see that tsup
generates an output that uses require("wagmi")
in dist/index.js
. Is there a good way to resolve this?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too