Tim Fish

Results 397 comments of Tim Fish

By default `import-in-the-middle` wraps every ES module (ie. every ESM file that loaded) with another module which proxies the exports which allows them to be modified after they've already been...

Without trying the code out yet myself, the ESM hook error suggests the app is bundled in some way or the full `node_modules` isn't getting deployed. It's trying to load...

I still need to test this locally to confirm but I think this issue is caused by the Netlify tooling not including all the required files in production builds. Netlify...

I suspect this is caused by https://github.com/vercel/nft/issues/428 You can probably work around this for now by specifying [`included_files` in your config](https://www.netlify.com/blog/2021/08/12/how-to-include-files-in-netlify-serverless-functions/) and forcing it to include the missing files.

I suspect you might need to include more so that not only the missing file is included, but also all the files it references too: ```toml [functions] included_files = ["node_modules/@opentelemetry/instrumentation/*",...

It looks like this might be a different bug caused by the CJS evaluation of `import-in-the-middle`. I found something similar but different [here](https://github.com/DataDog/import-in-the-middle/pull/93#issue-2329598165) with the `util-deprecate` package. @P4sca1 is there...

> you can't just import CJS packages in an ESM environment `import { X } from 'some-cjs-lib'` and `import * as lib from 'some-cjs-lib'` is supported by Node but it...

I think this is the cause: https://github.com/DataDog/import-in-the-middle/issues/95 Working on a fix!

I've just tested `import { PrismaClient } from '@prisma/client'` directly with `[email protected]` and it handles it correctly without error. Are you using TypeScript and transpiling to CommonJs? Is there anything...

Because prisma is CJS, I think this is fixed by https://github.com/DataDog/import-in-the-middle/pull/96 but I need to confirm