f5 / unovis

Modular data visualization framework for React, Angular, Svelte, Vue, and vanilla TypeScript or JavaScript
https://unovis.dev
Apache License 2.0
2.27k stars 44 forks source link

Named export 'group' not found. The requested module 'd3-array' is a CommonJS module, #449

Open Enable-Lukas opened 1 month ago

Enable-Lukas commented 1 month ago

unovis/svelte version: 10.8.1 unovis/ts version: 10.8.1 sveltejs/kit: 2.5.24

What I was doing:

I was installing a module from shadcn-svelte, which includes an import for @unovis/svelte. I installed it using npm i @unovis/svelte. After installing and importing it into my codebase, I encountered the error.

 Named export 'group' not found. The requested module 'd3-array' is a CommonJS module, which may not support all module.exports as named exports.
  CommonJS modules can always be imported via the default export, for example using:

  import pkg from 'd3-array';
  const { group, index } = pkg;

  import { group, index } from 'd3-array';
           ^^^^^
  SyntaxError: Named export 'group' not found. The requested module 'd3-array' is a CommonJS module, which may not support all module.exports as named exports.
  CommonJS modules can always be imported via the default export, for example using:

  import pkg from 'd3-array';
  const { group, index } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async nodeImport (file:///C:/Users/l-brostering/VS%20Code/Frontend/node_modules/vite/dist/node/chunks/dep-BzOvws4Y.js:52954:15)
at async ssrImport (file:///C:/Users/l-brostering/VS%20Code/Frontend/node_modules/vite/dist/node/chunks/dep-BzOvws4Y.js:52812:16)
at async eval (eval at instantiateModule (file:///C:/Users/l-brostering/VS%20Code/Frontend/node_modules/vite/dist/node/chunks/dep-BzOvws4Y.js:52861:24), <anonymous>:4:31)
at async instantiateModule (file:///C:/Users/l-brostering/VS%20Code/Frontend/node_modules/vite/dist/node/chunks/dep-BzOvws4Y.js:52870:5

I hope this was helpfull to fix the error it is my first issue. If you have anymore questents free to ask i try to help as good as i can. Thx for you time.

rokotyan commented 1 month ago

Looks like a dependency collision with some of the other libraries you may be using.