I'm trying to use the Plot library in a Node.js project, but I'm encountering issues due to the library being distributed as an ES module.
Here's the relevant part of my tsconfig.json:
{
"compilerOptions": {
"compilerOptions": {
"rootDir": "./src",
"outDir": "dist",
"target": "esnext",
"module": "commonjs",
"esModuleInterop": true,
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"removeComments": true,
"skipLibCheck": true,
"noImplicitAny": true,
"composite": true,
"noImplicitReturns": true,
// other options...
}
}
The error is:
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\path\node_modules\d3\src\index.js from C:\path\packages\libs\dist\jsfile.js not supported.
Usage:
import * as Plot from '@observablehq/plot';
I'm trying to use the Plot library in a Node.js project, but I'm encountering issues due to the library being distributed as an ES module.
Here's the relevant part of my
tsconfig.json:{ "compilerOptions": { "compilerOptions": { "rootDir": "./src", "outDir": "dist", "target": "esnext", "module": "commonjs", "esModuleInterop": true, "sourceMap": true, "declaration": true, "declarationMap": true, "removeComments": true, "skipLibCheck": true, "noImplicitAny": true, "composite": true, "noImplicitReturns": true, // other options... } }The error is:
Usage: