AOG Poston
a software engineer

Importing Sqlite3 into ElectronJS or NodeJS
by AOGPoston on 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.