ERR_UNSUPPORTED_DIR_IMPORT when loading component that uses LineVis from @h5web/lib #1562
|
I'm quite new to React and testing, but I have a basic application (using Vite, pnpm and Vitest) and am trying to run some simple unit tests on the components. As soon as I try and load a component that contains LineVis from h5web/lib I get: Any ideas on what I need to do to get these tests to run? |
Replies: 2 comments 10 replies
|
Hi @jacobfilik, we had this problem before but with older webpack versions. I'm surprised it happens with Vite (well, Vitest). Luckily, If it doesn't fix it, would you be able to replicate your issue in a sandbox so I can try to debug it? We have a Vite sandbox already, so you could fork it, make sure all the versions match your own set-up in |
|
Hi @axelboc, Thanks for looking into this! Updating to the beta, the app ran fine, vitest gave: `SyntaxError: Named export 'castArray' not found. The requested module 'lodash' is a CommonJS module, which may not support all module.exports as named exports. import pkg from 'lodash'; I will have a look at the sandbox tomorrow. |
I've just published
10.2.0-beta.2which removes thelodashwarning, as well as another one caused byreact-aria-menubutton. I've updated the original codesandbox to add Vitest and confirmed that it now works as expected: https://codesandbox.io/p/devbox/h5weblib-vite-xru04