Closed
Description
Hello folks ~
So thrilled to experiment w/ duckdb-wasm
! Thank you for all your hard work.
I'm having a bit of trouble bundling duckdb-wasm in a simple case. I'm using Rollup and opting for the simplest possible input file:
import * as duckdb from "@duckdb/duckdb-wasm/dist/duckdb-esm";
const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
console.log("resolving bundles");
async function resolve() {
// Select a bundle based on browser checks
const bundle = await duckdb.selectBundle(JSDELIVR_BUNDLES);
// Instantiate the asynchronus version of DuckDB-Wasm
const worker = new Worker(bundle.mainWorker);
const logger = new duckdb.ConsoleLogger();
const db = new duckdb.AsyncDuckDB(logger, worker);
return await db.instantiate(bundle.mainModule, bundle.pthreadWorker);
}
(async () => {
const db = await resolve();
console.log(db);
})();
But rollup produces this error:
rollup v2.59.0
bundles src/main.js → public/poc.js...
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
apache-arrow (imported by node_modules/@duckdb/duckdb-wasm/dist/duckdb-esm.js)
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules
apache-arrow (guessing 'apacheArrow')
Here is a repository that hopefully reproduces this (including my rollup file, includes instructions): https://github.com/hamilton/duckdb-wasm-issues
Is there something obvious that I'm missing here? (There usually is!)