DuckDB+Node.js utilities
-
db.ts:
Db
class (implemented with duckdb-async, falling back to duckdb-lambda-x86; see duckdb-node#15) -
duckdb.ts:
initDuckDb
,runQuery
iRe/www (interactive reports for Jupyter notebooks):
Use with Next.js
Inspired by next.js#46493 / node.bcrypt.js#979, you probably want this Webpack config in order to access duckdb-lambda-x86 from a Next.js app:
/** @type {import('next').NextConfig} */
const nextConfig = {
…,
+ webpack: (config) => {
+ config.externals = [...config.externals, 'duckdb', 'duckdb-lambda-x86'];
+ return config;
+ },
};
module.exports = nextConfig;
Otherwise you'll see errors like:
./node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html Module parse failed: Unexpected token (1:0)