From d21cc09556899b8038ec23613a801c19228637ca Mon Sep 17 00:00:00 2001 From: Sebastien Stettler Date: Fri, 15 Sep 2023 14:22:18 -0700 Subject: [PATCH] fix: conflict between browser URL object and Node URL object (#3061) I am running this package using electron, what i noticed was that due to the fact that the lines between node and browser environments become a bit blurred, the URL class that was being used was the one defined by the browser and not node. By making an explicit require it ensures the correct Class is used. While creating a test for this would be difficuilt i think adding an eslint rule to stop using globally defined objects and require imports instead would resolve issues like this in the future --- packages/pg-connection-string/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pg-connection-string/index.js b/packages/pg-connection-string/index.js index c7fc72a36..a005ffa20 100644 --- a/packages/pg-connection-string/index.js +++ b/packages/pg-connection-string/index.js @@ -1,9 +1,9 @@ 'use strict' - //Parse method copied from https://github.com/brianc/node-postgres //Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com) //MIT License +const { URL } = require('url') //parses a connection string function parse(str) { //unix socket