I'm getting the following error when doing import { CommandHandler } from "@event-driven-io/emmett" in a Nuxt project. Somehow Nuxt redirects incorrectly to /dist/index.js instead of /dist/index.mjs.
import { CommandHandler, getInMemoryEventStore } from 'node_modules/@event-driven-io/emmett/dist/index.js'; ^^^^^^^^^^^^^^ SyntaxError: The requested module 'node_modules/@event-driven-io/emmett/dist/index.js' does not provide an export named 'CommandHandler'
Directory import 'emmett/packages/emmett/dist/commandHandling' is not supported resolving ES modules imported from emmett/packages/emmett/dist/index.mjs
Description
I'm getting the following error when doing
import { CommandHandler } from "@event-driven-io/emmett"
in a Nuxt project. Somehow Nuxt redirects incorrectly to/dist/index.js
instead of/dist/index.mjs
.Reproduction
Here's the repo with the minimal reproduction: https://stackblitz.com/edit/nuxt-starter-nef6w3?file=app%2Fcounter.ts
Solution to above-mentioned issue
I managed to get rid of that error when I built locally emmet with a field inside package.json
But after that I got the following error: