-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
ReferenceError: __name is not defined #113
Comments
I think this is likely due to Can you check what version of
Make sure it's v2.3.2. If it's the latest version, please provide your reproduction in a repository so I can install it with the exact environment. |
Yes, the @esbuild-kit/core-utils version is 2.3.2. Pushed a small repro here: https://github.com/Uninen/tsx-issue-113-repro |
Thanks for the reproduction. This is happening because esbuild's This is a stated limitation so I wouldn't consider it a bug. It probably works with tsm because it doesn't have ExampleIn this example, the inner To fix this problem, I filed a feature request to only apply Alternatively, I can also shim |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
Yep, hence the blocked tag on this Issue. |
reproduce.mts // @ts-check
import playwright from 'playwright-core'
const browser = await playwright.firefox.launch()
const browserContext = await browser.newContext()
const page = await browserContext.newPage()
await page.goto('http://127.0.0.1:1234/')
await page.waitForFunction('() => true')
await page.close()
await browserContext.close()
await browser.close()
|
Workaround, using But If you are using typescript 5.0, you may see related TypeStrong/ts-node#2000 $ npm exec -- tsc --showConfig > tsconfig.tsnode.json
$ npm exec -- ts-node --project tsconfig.tsnode.json --esm --swc ./reproduce.mts && echo OK
OK But I'm still curious about what is the esbuild underlying problem, very appreciated for any explanation. |
Workaround updated
$ npm exec -- tsc --showConfig > tsconfig.tsnode.json
$ npm exec -- ts-node --project tsconfig.tsnode.json --esm --swc ./reproduce.mts && echo OK
OK |
Read #113 (comment) |
I read before I said that. But I don't understand how
I think should filed with BUG, with a small example throws If a bundler generate different runtime output, when Besides, see #228, So, seems it is a |
It's kind of both.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This specific problem is blocked by esbuild—out of my hands. However, the 2 issues under "Optimize dependency transformations" on the Roadmap will address this from happening in dependencies. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
The specific problem with However, I'll leave this open because it's not completely fixed for all cases (e.g a dependency module that uses both ESM/TypeScript and |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
With https://github.com/privatenumber/tsx/releases/tag/v4.0.0 released, this will likely no longer be an issue in the majority of cases. Hope it works well for yall! Keeping this issue open but labelled "Blocked" because the root issue is in esbuild. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Locking this thread since the problem is well-understood, and further investigation isn't needed. The issue is blocked by evanw/esbuild#2605 Please avoid commenting "bump" or "please fix". |
Bug description
I'm trying to use Playwright screenshot function w/ tsx from command line. This has worked in previous versions and works with tsm but doesn't work w/ tsx.
Reproduction
Runing
npx tsx src/testfn.ts
produces following error:Environment
-->
The text was updated successfully, but these errors were encountered: