Skip to content

import parquet-wasm from local bundle rather than CDN #457

@cornhundred

Description

@cornhundred

Hi, is it possible to import parquet-wasm using esbuild rather than a CDN? I see that parquet-wasm is a dependency in the package.json

lonboard/package.json

Lines 5 to 20 in c8cf2e1

"dependencies": {
"@anywidget/react": "^0.0.4",
"@babel/runtime": "^7.24.1",
"@deck.gl/core": "^8.9.35",
"@deck.gl/extensions": "^8.9.35",
"@deck.gl/layers": "^8.9.35",
"@deck.gl/react": "^8.9.35",
"@geoarrow/deck.gl-layers": "^0.3.0-beta.16",
"apache-arrow": "^15.0.2",
"maplibre-gl": "^3.6.2",
"parquet-wasm": "0.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-map-gl": "^7.1.7",
"uuid": "^9.0.1"
},

but lonboard is also referencing a CDN here:

lonboard/src/parquet.ts

Lines 2 to 19 in c8cf2e1

import _initParquetWasm, { readParquet } from "parquet-wasm/esm/arrow2";
import * as arrow from "apache-arrow";
// NOTE: this version must be synced exactly with the parquet-wasm version in
// use.
const PARQUET_WASM_VERSION = "0.5.0";
const PARQUET_WASM_CDN_URL = `https://cdn.jsdelivr.net/npm/parquet-wasm@${PARQUET_WASM_VERSION}/esm/arrow2_bg.wasm`;
let WASM_READY: boolean = false;
export async function initParquetWasm() {
if (WASM_READY) {
return;
}
await _initParquetWasm(PARQUET_WASM_CDN_URL);
WASM_READY = true;
}

I ask because I'm trying to test out lonboard on a service that prevents me from making front-end requests to CDNs (I would have to request the URL be added to an allowlist, but I want to see if I can avoid this by bundling the code with esbuild but I was running into errors when I tried to use the bundled version - kylebarron/parquet-wasm#488).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions