ComPlat / react-spectra-editor

An editor to View and Edit Chemical Spectra data (NMR, IR and MS).
GNU Affero General Public License v3.0
10 stars 5 forks source link

Error when using version 1.1.0 with ELN because d3 js #197

Closed baolanlequang closed 8 months ago

baolanlequang commented 8 months ago

The error is

Error [ERR_REQUIRE_ESM]: require() of ES Module /__w/chemotion_ELN/chemotion_ELN/node_modules/@complat/react-spectra-editor/node_modules/d3/src/index.js from /__w/chemotion_ELN/chemotion_ELN/node_modules/@complat/react-spectra-editor/dist/components/d3_line/line_focus.js not supported.
Instead change the require of index.js in /__w/chemotion_ELN/chemotion_ELN/node_modules/@complat/react-spectra-editor/dist/components/d3_line/line_focus.js to a dynamic import() which is available in all CommonJS modules.

This can be fixed by changing from import * as d3 from 'd3'; to const d3 = require('d3');

baolanlequang commented 8 months ago

@f-idiris I think we should change how to import d3 not only in d3_line/line_focus.js but also in the other places.