Skip to content

Commit

Permalink
fix: conflict between browser URL object and Node URL object
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 committed Sep 6, 2023
1 parent a84ebb3 commit 989d6a7
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,5 +1,5 @@
'use strict'

const { URL } = require('node:url')
//Parse method copied from https://github.com/brianc/node-postgres
//Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)
//MIT License
Expand Down

0 comments on commit 989d6a7

Please sign in to comment.