Code Monkey home page Code Monkey logo

erb-sqlite-example's Introduction

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
cd app && yarn
cd ..
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

The changes that were made were installing sqlite to ./app/package.json:

cd app
yarn add sqlite -S

erb-sqlite-example's People

Contributors

amilajack avatar othke avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.