Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of fix-esm seems to break the tsx #52

Closed
Papooch opened this issue Dec 12, 2023 · 5 comments · May be fixed by #53
Closed

Use of fix-esm seems to break the tsx #52

Papooch opened this issue Dec 12, 2023 · 5 comments · May be fixed by #53

Comments

@Papooch
Copy link

Papooch commented Dec 12, 2023

I am using tsx for autoreload of dev server, but as soon as I install @koa/multer, I get this error:

TypeError: Cannot assign to read only property '.mjs' of object '[object Object]'

Similar to the one reported here: privatenumber/tsx#230

It seems the culprit is this line here: let originalMulter = require('fix-esm').require('multer');

So my question is - why is the fix-esm module required here and can this be fixed from your side?

Versions:

  • node: 20.8.1
  • @koa/multer: 3.0.2
@titanism
Copy link
Contributor

This is because multer is not published with CJS support.

@hpx7
Copy link

hpx7 commented Dec 28, 2023

@titanism are there any workarounds for this you can suggest?

EDIT: It's important to note that https://www.npmjs.com/package/multer and Express.Multer works with tsx, but not this package

@hpx7
Copy link

hpx7 commented Dec 28, 2023

Simply removing require('fix-esm') from index.js seems to fix it for me with tsx

@hpx7 hpx7 mentioned this issue Dec 29, 2023
@jfaissolle
Copy link

This is because multer is not published with CJS support.

@titanism Are you sure ? It seems to me that multer is published as CJS only

@kevinmamaqi
Copy link

Any workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants