You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering why is that tsup not shimming the require.resolve correctly?
Adding this shim myself, before using require works correctly:
constrequire_=createRequire(__filename??// @ts-expect-error Forward compat. The `import.meta` meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.import.meta.url,)
This error is thrown by Vitest, when running tests against a project using a package compiled by
tsup
.The bundled code of
lib/index.mjs
looks like this:Here's the
tsup.config.json
that was used to build the library:I'm wondering why is that
tsup
not shimming therequire.resolve
correctly?Adding this shim myself, before using
require
works correctly:Package versions:
Related Issues
tsup
issue that says it was fixed: TypeError: __require.resolve is not a function #369esbuild
: How to fix "Dynamic require of "os" is not supported" evanw/esbuild#1921 (comment)Upvote & Fund
The text was updated successfully, but these errors were encountered: