Skip to content

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

License

Notifications You must be signed in to change notification settings

wrongjun/erb-sqlite-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

erb-sqlite-example

Build Status

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

Setup

⚠️ These instructions assume that you have yarn. If you don't, make sure to install it: npm i -g yarn

git clone https://github.com/amilajack/erb-sqlite-example.git
cd erb-sqlite-example && yarn
yarn dev

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 ./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 ./app/package.json. These dependencies are automatically rebuilt against electron's node version after installing (see the postinstall script in ./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 --save my-cool-depencency and like so for yarn: yarn add my-cool-depencency -S.

Notes

These changes that were made to ERB:

cd app
yarn add sqlite

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.9%
  • HTML 2.0%
  • CSS 0.1%