Open cjroebuck opened 2 years ago
Should add, this is within an ESM module where "type":"module"
is present in package.json.
And tsconfig.json for this is:
{
"compilerOptions": {
"moduleResolution": "Node",
"skipLibCheck": true,
"lib": ["es2020"],
"module": "ES2020",
"target": "es6",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
}
}
I can confirm that this has been happening to me in a yarn workspace as well, even with esr ./my/file.ts
EDIT: I found a repeatable way to repro this in yarn 2+ - if for some reason yarn pnpEnableEsmLoader: true
is set in .yarnrx.yml
, this always happens. In case this is not set, if @yarnpkg/cli
is part of the yarn workspace tree, this happens then as well.
EDIT 2: Turns out, the esm loader is the one that is screwing it up for me. This is what I had to configure in my yarn 2 workspace (.yarnrc.yml
) to get esbuild-runner to work -
enableGlobalCache: false
pnpEnableEsmLoader: false
That made esr
work for me.
I'm getting ERR_UNKNOWN_FILE_EXTENSION
as well using esr in my ESM project, using NPM.
https://github.com/antfu/esno seems to work with ES modules.
why is it still not solved after half a year
Yep, I'm using tsx as well now and it's been working great.
Moved to tsx as well
Did you find a way to add esbuild configuration using tsx ? (something like esbuild-runner.config.js
file would be great)
I gave this package a shot today and was immediately greeted with this very issue. I was intrigued as to why there are no signs of this getting fixed after almost 3 years, until I realized this package's latest development was from 2 years ago!
I assume this package as unmaintained.
Not sure what I'm doing wrong but...
helloworld.ts: