-
Notifications
You must be signed in to change notification settings - Fork 221
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
[bug]: algoliasearch
fails with tsx
and ESM ("type": "module")
#1565
[bug]: algoliasearch
fails with tsx
and ESM ("type": "module")
#1565
Comments
Reverting to 5.8.1 did fix it for now. (our deploy script wasn't respecting the package.json |
Hey @karlhorky thanks for reporting the issue and the investigation!! I thought it was due to some treeshaking removing unused deps but leaving type imports, but you are right we shouldn't publish this typescript file! edit: although I wonder why it worked before 🤔 I'll continue the investigation |
It looks like this fix has been released, but I'm still seeing these compiling errors, any suggestions? I'm seeing them in a slightly different place from what's shown here and in issue #1566:
|
@shortcuts @Haroenv thanks for the release of I updated my reproduction to both versions and the same output appears: CodeSandbox: https://codesandbox.io/p/devbox/algoliasearch-tsx-forked-d9q3d8?file=%2Fpackage.json $ pnpm tsx index.ts
/project/workspace/node_modules/.pnpm/[email protected]/node_modules/algoliasearch/builds/models.ts:19
import { EventType } from '@algolia/client-personalization';
^
SyntaxError: The requested module '@algolia/client-personalization' does not provide an export named 'EventType'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Node.js v20.12.0 Can this issue be reopened? |
Hey @sgilberg @karlhorky I finally found the issue, thanks to your stacktraces and reproduction! seems like omitting the |
@shortcuts I can confirm that this is now resolved in CodeSandbox: https://codesandbox.io/p/devbox/algoliasearch-tsx-forked-wdgllg?file=%2Fpackage.json $ pnpm start
> [email protected] start /project/workspace
> tsx index.ts
algoliasearch [Function: algoliasearch] |
lets gooooo thanks @karlhorky for testing! |
I originally reported this over here, but the
"skipLibCheck": false
was a red herring for my particular issue (still leaving it open in case it's interesting on its own): #1564Description
CodeSandbox: https://codesandbox.io/p/devbox/p6w2mq?file=%2F.codesandbox%2Ftasks.json%3A12%2C15
Running
algoliasearch
withtsx
and ESM ("type": "module"
) will cause a crash"type": "module"
inpackage.json
algoliasearch
andtsx
index.ts
file with a simple named import ofalgoliasearch
pnpm tsx index.ts
cc @shortcuts wonder if this is related to algolia/api-clients-automation#3966 (considering that the error is in a
.ts
file)Client
Search
Version
5.9.1
Relevant log output
The text was updated successfully, but these errors were encountered: