Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pg-native is not found in a monorepo with pnpm or yarn pnpmΒ #281

@vjpr

Description

@vjpr
  1. It fails silently if you have preferNativeBindings. It should show a warning to stdout.
  2. In pnpm node_modules is not flattened so you need to explcitily declare the peer dep.
  3. There should be the option to pass in the pg-native module. E.g. createPool(uri, {pgModule: require('pg-native')}).
  4. Add a note to the readme.md about it.

Fix:

  "peerDependenciesMeta": {
    "pg-native": {
      "optional": true
    }
  },

Related: #240 #115

Workaround for pnpm

.pnpmfile.cjs

  // See: https://github.com/gajus/slonik/issues/281
  if (pkg.name === 'slonik') {
    pkg.dependencies = {
      ...pkg.dependencies,
      pg: '*',
      'pg-native': '*',
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions