Skip to content

Commit

Permalink
fix: conflict between browser URL object and Node URL object (#3061)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
billybonks authored Sep 15, 2023
1 parent da0f5c5 commit d21cc09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pg-connection-string/index.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d21cc09

Please sign in to comment.