how_to_check_pure_esm
Check the notes for pure esm
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
Check remix notes on esm/cjs problems
https://remix.run/docs/en/main/guides/vite#esm--cjs
Applying the Solution Generally
This pattern can be applied to any module that might export differently based on ESM or CJS.
import someModuleSource from 'some-module';
const someModule = (someModuleSource as any).default ?? someModuleSource;