eazychart icon indicating copy to clipboard operation
eazychart copied to clipboard

🤔 [ISSUE] - @eazychart-[core]- require() of ES Module

Open yassinedorbozgithub opened this issue 2 years ago • 0 comments

Description

I get an issue when i run the node index.js file with this code const linearScale = new ScaleLinear([0,1,2,4,5,6],[0, 800]);

Reproduction steps

mkdir src cd src touch index.js

import { ScaleLinear } from "eazychart-core";
const linearScale = new ScaleLinear([0,1,2,4,5,6],[0, 800]);

node src/index.js

Screenshots

https://user-images.githubusercontent.com/95612053/192030171-52e6d2cc-c459-4fda-bf6e-543f0aa41baf.png

Logs

/home/yassinedorboz/Bureau/hexastack/eazychart/node_modules/eazychart-core/dist/eazychart-core.cjs.development.js:5
var d3Scale = require('d3-scale');
              ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/yassinedorboz/Bureau/hexastack/eazychart/node_modules/d3-scale/src/index.js from /home/yassinedorboz/Bureau/hexastack/eazychart/node_modules/eazychart-core/dist/eazychart-core.cjs.development.js not supported.
Instead change the require of index.js in /home/yassinedorboz/Bureau/hexastack/eazychart/node_modules/eazychart-core/dist/eazychart-core.cjs.development.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/yassinedorboz/Bureau/hexastack/eazychart/node_modules/eazychart-core/dist/eazychart-core.cjs.development.js:5:15)
    at Object.<anonymous> (/home/yassinedorboz/Bureau/hexastack/eazychart/node_modules/eazychart-core/dist/index.js:7:20)
    at async Promise.all (index 0) {
  code: 'ERR_REQUIRE_ESM'
}

Browsers

No response

OS

Linux

yassinedorbozgithub avatar Sep 23 '22 18:09 yassinedorbozgithub