mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
Merge pull request #19 from crisvergara/master
Fix require for webpack compatibility
This commit is contained in:
commit
24d85f5e17
11
pg.js
11
pg.js
@ -1,13 +1,10 @@
|
||||
var path = require('path')
|
||||
var pgPath;
|
||||
//support both pg & pg.js
|
||||
//this will eventually go away when i break native bindings
|
||||
//out into their own module
|
||||
try {
|
||||
pgPath = path.dirname(require.resolve('pg'))
|
||||
module.exports.Result = require('pg/lib/result.js')
|
||||
module.exports.prepareValue = require('pg/lib/utils.js').prepareValue
|
||||
} catch(e) {
|
||||
pgPath = path.dirname(require.resolve('pg.js')) + '/lib'
|
||||
module.exports.Result = require('pg.js/lib/result.js')
|
||||
module.exports.prepareValue = require('pg.js/lib/utils.js').prepareValue
|
||||
}
|
||||
|
||||
module.exports.Result = require(path.join(pgPath, 'result.js'))
|
||||
module.exports.prepareValue = require(path.join(pgPath, 'utils.js')).prepareValue
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user