react-focus-lock icon indicating copy to clipboard operation
react-focus-lock copied to clipboard

Failing to import ESM module in Node

Open brynshanahan opened this issue 7 months ago • 2 comments

A consumer of our component library is trying to import react-focus-lock in Vitest as a nested dependency which is failing because Node imports the ESM module as { default: FocusLockComponent } rather than FocusLockComponent

I have a reproduction here. If you run yarn workspace common node-test then it shows that the component is being imported incorrectly.

I think a solution might be to use the .mjs extension for the dist/es2015 folder but I'm not totally sure

brynshanahan avatar Jul 17 '24 23:07 brynshanahan