Comments (5)
Your build step does not understand importing es modules
. You should update your app build step so that it is able to import es modules
(maybe try vite
, esbuild
, webpack5
etc). To verify, maybe add https://www.npmjs.com/package/lodash-es as a dependency and see if you can import any of the helper functions from lodash-es
. If you cannot use es modules
, you will not be able to use this library.
from react-d3-speedometer.
I'm getting this error using NextJS 13. Reading that NextJS 12 and up should be able to use ES Modules by default.
It actually worked the moment I added it, but when I refresh the page or visit the page later it crashes and sends the same error re lodash.
Error: require() of ES Module /Users/user/code/project/node_modules/lodash-es/isNumber.js from /Users/user/code/project/node_modules/react-d3-speedometer/dist/core/util/index.js not supported.
Instead change the require of isNumber.js in /Users/user/code/project/node_modules/react-d3-speedometer/dist/core/util/index.js to a dynamic import() which is available in all CommonJS modules.
Code was copy pasted from the example without changes.
from react-d3-speedometer.
Reading that NextJS 12 and up should be able to use ES Modules by default.
Please share a nextjs documentation link to check on this behavior.
from react-d3-speedometer.
Reading that NextJS 12 and up should be able to use ES Modules by default.
Please share a nextjs documentation link to check on this behavior.
Not finding much documentation on the main website, only in Issues. It sounds very simple, with two solutions... I've tried adding "type": "module" and it broke Next Auth. I've tried adding the .mjs extension to the page, but then the page shows a 404. So, I'm not really sure what's to be done about ES Modules here.
Currently getting it to work (very slow) on routed-to instances and ~50% of page refreshes by bringing it in as a dynamic import. It's still throwing a fit about react-d3-speedometer importing lodash-es/isNumber.js.
from react-d3-speedometer.
Found the issue. When I installed using yarn add react-d3-speedometer
it was installing version 1.x which the documentation says works for React 17. I am using React 18, recognized the version number and installed using yarn add [email protected]
and it works great!
from react-d3-speedometer.
Related Issues (20)
- "Error: require() of ES Module" while unit testing with vitest and react-resting library
- Hi guys i am working on react speedometer chart in my company project where i want seven emotion and that niddle should move to the dominant emotion value and perticular to the colored segment as well
- Hi guys i am working on react speedometer chart in my company project where i want seven emotion and that niddle should move to the dominant emotion value and perticular to the colored segment as well
- Target animation HOT 1
- Fluid Width prop to take only necessary height HOT 5
- How to add a linear gradient color to needle HOT 5
- Allow `segmentValueFormatter` to return a DOM node HOT 2
- Having two labels HOT 1
- Possible to make needle stop at max value? HOT 3
- Minus sign used in "segmentValueFormatter" is wrong HOT 2
- Setting Full width Prop to true is make the speedometer component to render partially and then re render on state change HOT 3
- Tooltip on hover on the segment HOT 1
- First value should be equivalent to min value given. Current min value - 1000 HOT 2
- Typescript React v18 react-d3-speedometer@next. I am getting Could not find a declaration file for module 'react-d3-speedometer'. HOT 1
- Custom Segment Labels should be an array with length of 10
- When will v2.0 become general available? is it stable already? HOT 2
- Custom segment labels display error HOT 3
- maxSegmentLabels not working HOT 1
- Can I set maxValue Dynamic HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-d3-speedometer.