observablehq / plot

A concise API for exploratory data visualization implementing a layered grammar of graphics
https://observablehq.com/plot/
ISC License
4.13k stars 172 forks source link

react import of @observablehq/plot results in d3 error message `The requested module 'd3' does not provide an export named 'unixDay'` #1890

Closed cindyloo closed 9 months ago

cindyloo commented 9 months ago

Chrome Version 117.0.5938.149 (Official Build) (arm64) mac os Ventura react v.17+

imports: import * as Plot from "@observablehq/plot"; import { useRef, useEffect, useState } from "react"; import Stack from '@mui/material/Stack'; import Slider from '@mui/material/Slider'; import { CalendarPicker } from "@mui/lab";

trying to plot times as javascript new Date()

Fil commented 9 months ago

Is D3 up to date? unixDay was added in https://github.com/d3/d3/releases/tag/v7.7.0

cindyloo commented 9 months ago

this appears to not be in the npm installation of @observablehq/plot... is that not part of your updates? it seems that this module includes d3 as part of the installation...

mbostock commented 9 months ago

D3 is a dependency of Plot. You appear to have an older version installed that does not meet the version requirements in the package.json.

https://github.com/observablehq/plot/blob/32cd30116503a99c0497968b8f736a7769c0b1ff/package.json#L91

cindyloo commented 9 months ago

interesting b/c I uninstalled d3 and still received that message.. I'll have another look

cindyloo commented 9 months ago

had to delete node_modules, package-lock and npm install. Working now ty