Skip to content

Cloning the library throws error when pg-native is not installed #945

Closed
@janmeier

Description

@janmeier

Related to sequelize/sequelize#5438 and sequelize/sequelize#5476.

var pg = require('pg')
_.clone(pg);

Throws Error: Cannot find module 'pg-native'

Wanting to clone the library directly doesn't make much sense, but in the issues linked above, it happens because a sequelize model, which has a reference to pg is being deeply cloned.

This should be fixable by switching to defineProperty and marking the native property as non-enumerable.

I can write up a PR later today if you'd like - I just need a hint as to where to put the test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions