kylefarris / node-querybuilder

Node QueryBuilder Adapter for Node.js (tags: nodejs, node, mysql, active record, activerecord, querybuilder, query builder)
49 stars 19 forks source link

[2.0.0-beta.1] Webpack can't find driver module when path includes '//' #39

Closed Flamenco closed 6 years ago

Flamenco commented 6 years ago

I am bundling this library into a single JS. The driver is not resolved at runtime. Notice in the log the path ./drivers/mysql//adapters/pool.js

Here is the error.

Error: Couldn't load the "pool" Adapter library for mysql ({"host":"***","user":***","password":"***","database":"***"}): Error: Cannot find module './drivers/mysql//adapters/pool.js'
    at module.exports.get_adapter (/Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:7:15912)
    at new module.exports (/Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:7:13859)
    at Object.<anonymous> (/Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:1:4427)
    at __webpack_require__ (/Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:1:309)
    at Object.<anonymous> (/Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:164:370558)
    at __webpack_require__ (/Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:1:309)
    at /Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:1:1601
    at Object.<anonymous> (/Users/steven/dev/projects/other/quickchords-server/src/main/resources/dist/main.js:1:1648)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)

Here's the call.

 case 'pool':
                    const Pool = require(`${this.driver_info.path}/adapters/pool.js`)
                    return new Pool(settings);

suggestions

Also, the error dumped displays my connection username and password. That's a bit concerning.

kylefarris commented 6 years ago

Issue resolved by #40