egoist / egoist/tsup

If different versions of "graphql" are the dependencies

Open
#803 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

'pnpm dev' problem

```ts
import type { Options } from 'tsup'

import pkg from './package.json'

const noExternal = [
...Object.keys(pkg.dependencies || {}),
]

export default {
entryPoints: ['src/index.ts'],
outDir: 'dist',
target: 'node18', // needed for working ESM
format: ['esm'],
splitting: false,
sourcemap: true,
clean: true,
noExternal,
skipNodeModulesBundle: true,
banner: ({ format }) => {
if (format === 'esm') {
return {
// eslint-disable-next-line @typescript-eslint/quotes
js: `import {createRequire as __createRequire} from 'module';var require=__createRequire(import\.meta.url);`,
}
}
},
footer: ({ format }) => {
if (format === 'cjs') {
return {
// eslint-disable-next-line @typescript-eslint/quotes
js: `if (module.exports.default) module.exports = module.exports.default;`,
}
}
},
// dts: true,
}

```

package.json

```json
{
"name": "@aa/server",
"type": "module",
"version": "0.0.1",
"private": true,
"author": "@productdevbook",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/**",
"package.json"
],
"scripts": {
"build": "tsup",
"dev": "tsup-node src/dev.ts --format esm --shims --target node16 --watch --sourcemap --onSuccess 'node --enable-source-maps dist/dev.js' | pino-pretty --translateTime HH:MM:ss TT --ignore pid,hostname"
},
"dependencies": {
"@abraham/reflection": "^0.11.0",
"@aws-sdk/client-s3": "^3.231.0",
"@clickhouse/client": "^0.0.11",
"@envelop/generic-auth": "^5.0.4",
"@envelop/graphql-modules": "^4.0.4",
"@envelop/response-cache-redis": "^2.0.4",
"@fastify/autoload": "^5.6.0",
"@fastify/cors": "^8.2.0",
"@fastify/formbody": "^7.4.0",
"@fastify/multipart": "^7.3.0",
"@graphql-tools/links": "^8.3.24",
"@graphql-tools/load-files": "^6.6.1",
"@graphql-tools/resolvers-composition": "^6.5.14",
"@graphql-tools/schema": "^9.0.12",
"@graphql-yoga/plugin-response-cache": "^1.1.1",
"@graphql-yoga/redis-event-target": "^1.0.0",
"@huntersofbook/relay-cursor-paging": "^0.1.3",
"@placemarkio/check-geojson": "^0.1.12",
"blurhash": "^2.0.4",
"dataloader": "^2.1.0",
"dotenv": "^16.0.3",
"geojson": "^0.5.0",
"graphql": "16.6.0",
"graphql-modules": "^2.1.0",
"graphql-relay": "^0.10.0",
"graphql-scalars": "^1.20.1",
"graphql-yoga": "^3.1.1",
"hyperid": "^3.0.1",
"ioredis": "^5.2.4",
"knex": "^2.3.0",
"merge-anything": "^5.1.4",
"nanoid": "^4.0.0",
"pathe": "^1.0.0",
"supertokens-node": "^12.1.2",
"uuid": "^9.0.0",
"wait-on": "^6.0.1",
"wkx": "^0.5.0",
"zod": "^3.19.1",
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
"@types/sharp": "^0.31.0",
"@types/wait-on": "^5.3.1",
"consola": "^2.15.3",
"fastify": "^4.10.2",
"pino-pretty": "^9.1.1",
"typescript": "^4.9.4"
},
"pnpm": {
"overrides": {
"graphql": "16.6.0"
},
"peerDependencyRules": {
"allowedVersions": {
"graphql": "16.6.0"
}
}
},
"resolutions": {
"graphql": "16.6.0"
},
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.