Webpack can not use __dirname?
问题 I am trying to use node-postgres to hook my app up to Postgres. The code I use is: import React from 'react'; import pg from 'pg'; import fs from 'fs'; var cn = { host: 'localhost', // server name or IP address; port: 5432, database: 'my_db', user: 'myname', password: 'mypass' }; and it produces the error: index.js:5 Uncaught ReferenceError: __dirname is not defined up @ index.js:5 __webpack_require__ @ bootstrap 539ecc7…:19 (anonymous function) @ client.js:4 __webpack_require__ @ bootstrap