Amon Otis Poston
Human Rights Focused Computer Scientist
PGP Fingerprint: 856B 3022 A763 BB23 EA1E DD91 E784 D6D5 7CAB 42A2

Importing Sqlite3 into ElectronJS or NodeJS
04/28/24

You may be locked into a sick dance between your transpiler, the tutorials, and your codebase. In my case, I was trying to simply get SQLite3 to work in my ElectronJS project, however none of tutorials explained how could import it into my project. I eventually found a github thread which went into detail about how to write the import statemtent.

So, Im passing it onto you.

Here is an exrept from the sqlite3 npm package:

const sqlite3 = require("sqlite3").verbose();
const db = new sqlite3.Database(":memory:");

It is written in CommonJS. To turn these into an ES6 Import statement, write this:

import sqlite3 from "sqlite3";
const db = new sqlite3.Database(":memory:");

Dont worry, I couldnt figure it out either. I get it.