Skip to content

Commit d21cc09

Browse files
authored
fix: conflict between browser URL object and Node URL object (brianc#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
1 parent da0f5c5 commit d21cc09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/pg-connection-string/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict'
2-
32
//Parse method copied from https://github.com/brianc/node-postgres
43
//Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)
54
//MIT License
65

6+
const { URL } = require('url')
77
//parses a connection string
88
function parse(str) {
99
//unix socket

0 commit comments

Comments
 (0)