node-sqlcipher icon indicating copy to clipboard operation
node-sqlcipher copied to clipboard

Webpack node-sqlcipher

Open nimeshkan opened this issue 4 years ago • 1 comments

I tried to add to mozilla-iot code , @ry @journeyapps/sqlcipher gateway/build/webpack:/src/sqlcipher/lib sync:2 var e = new Error("Cannot find module '" + req + "'"); ^ Error: Cannot find module gateway/src/sqlcipher/lib/binding/napi-v6-linux-x64/node_sqlite3.node' at webpackEmptyContext (gateway/build/webpack:/src/sqlcipher/lib sync:2:1) at Object. (gateway/build/webpack:/src/sqlcipher/lib/sqlite3-binding.js:4:15) at Object../src/sqlcipher/lib/sqlite3-binding.js gateway/build/gateway.js:17792:30) at webpack_require (/gateway/build/webpack:/webpack/bootstrap:19:1) at Object../src/sqlcipher/lib/sqlite3.js (gateway/build/webpack:/src/sqlcipher/lib/sqlite3.js:2:15) at webpack_require (/home/nimesh/workspace/XERUS/HUB/Sriharsha-alert/gateway/build/webpack:/webpack/bootstrap:19:1) at Object../src/sqlcipher/sqlite3.js (gateway/build/webpack:/src/sqlcipher/sqlite3.js:1:18) at webpack_require (gateway/build/webpack:/webpack/bootstrap:19:1) at Object../src/db.js gateway/build/webpack:/src/db.js:15:19) at webpack_require (gateway/build/webpack:/webpack/bootstrap:19:1)

nimeshkan avatar Jan 10 '21 17:01 nimeshkan

Native node modules are in general not well suited for webpack.

You should be able to exclude it from bundling by using externals, for example:

module.exports = {
  // ...
  externals: {
    '@journeyapps/sqlcipher': 'commonjs2 @journeyapps/sqlcipher',
  }
};

(not tested, and will depend on your specific setup)

rkistner avatar Jan 11 '21 14:01 rkistner