Skip to content

Commit af84d5c

Browse files
committed
Fix require for webpack compatibility
1 parent 4f62085 commit af84d5c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pg.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
var path = require('path')
2-
var pgPath;
31
//support both pg & pg.js
42
//this will eventually go away when i break native bindings
53
//out into their own module
64
try {
7-
pgPath = path.dirname(require.resolve('pg'))
5+
module.exports.Result = require('pg/lib/result.js')
6+
module.exports.prepareValue = require('pg/lib/utils.js').prepareValue
87
} catch(e) {
9-
pgPath = path.dirname(require.resolve('pg.js')) + '/lib'
8+
module.exports.Result = require('pg.js/lib/result.js')
9+
module.exports.prepareValue = require('pg.js/lib/utils.js').prepareValue
1010
}
11-
12-
module.exports.Result = require(path.join(pgPath, 'result.js'))
13-
module.exports.prepareValue = require(path.join(pgPath, 'utils.js')).prepareValue

0 commit comments

Comments
 (0)