m4ss1m0g / mediatr-ts

Mediator patter for Typescript, inspired to MediatR csharp library
MIT License
49 stars 10 forks source link

Does not work with vite and commonJs for a typescript project. #13

Closed raghurana closed 1 year ago

raghurana commented 1 year ago

Getting a failed to import with a vite project for a commonjs typescript project

image

type is set to commonjs in my package.json

and tsconfig.json looks like

{
  /* Visit https://aka.ms/tsconfig to read more about this file */
  "compilerOptions": {
    "module": "commonjs",
    "outDir": "dist",
    "strict": true,
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitAny": true,
    "skipLibCheck": true
  },
  "exclude": ["node_modules", "vite.config.ts"]
}

PS: This works in version 1.0.0

m4ss1m0g commented 1 year ago

On the last update 1.1.0 I merged PR #12 where it adds support for the ESM module. This functionality can lead to an error when both ESM and Commonjs modules are loaded. Check this doc