Closed ManuelR-D closed 2 months ago
JavaScript data loaders are simply normal Node.js programs. You can’t use npm: imports as these are not supported natively by Node.js. You should use the normal Node.js APIs to read files (typically importing from node:fs/promises).
I just wanted to clarify that npm:
is not allowed in data loaders. I understand that the OP was misusing FileAttachment
, but I get the same error above when I write a data loader like:
import { readParquet } from "npm:parquet-wasm";
...
In other words, as a "simply normal Node.js program," a data loader uses normal ESM loaders import modules and does not have access to npm:
?
@muziejus Correct.
Thanks!
I'm trying to use a data loader with the following code
and I get the following error during build time
Am I doing something wrong? Is FileAttachment supposed to work within a data loader?
Edit: tried this with Node v20.17.0 and v22.7.0