All Projects → amilajack → erb-sqlite-example

amilajack / erb-sqlite-example

Licence: MIT License
An example of erb with native dependencies (sqlite3 in this case)

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

erb-sqlite-example

Test

An example of erb with native dependencies (sqlite3 in this case)

Setup

git clone https://github.com/amilajack/erb-sqlite-example.git
cd erb-sqlite-example
npm i
npm start

How it works

sqlite3 is a native dependency that needs to be compiled before it is used (therefore it is consiered 'native dependency'). sqlite3 and any other depencencies in ./build/app/package.json are imported as an externals, which means that webpack doesn't process them. The dependency will be imported with normal require() calls.

Some native dependencies have issues with how webpack bundles code. One solution to these kinds of issues is to add those native dependencies to your ./build/app/package.json. These dependencies are automatically rebuilt against electron's node version after installing (see the postinstall script in ./build/app/package.json). electron-builder will also rebuild dependencies just before packaging your app.

You must install the dependencies as dependencies and not devDepencencies. Make sure to install like so for npm: npm install my-cool-depencency and like so for npm: npm i my-cool-dependency.

Notes

These changes that were made to ERB:

cd build/app
npm i sqlite3
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].