Skip to content
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

chore(headless): fix internal resolution errors in node16 #4445

Merged
merged 17 commits into from
Sep 24, 2024

Conversation

alexprudhomme
Copy link
Contributor

@alexprudhomme alexprudhomme commented Sep 20, 2024

Unit tests are failing. This is adressed here, once all PRs are approved we will merge in #4442

Publint status

  • atomic : no errors
  • headless: no errors
  • atomic-react: no errors

Are the types wrong status

  • atomic : errors Internal resolution in node16 (Do we need to address this ? People don't use atomic with typescript anyway ?) + cjs type warnings
  • headless: cjs type warnings
  • atomic-react: cjs type warnings

Comment on lines -7 to +9
"module": "ES2022",
"module": "Node16",
"target": "ES2022",
"moduleResolution": "Bundler",
"moduleResolution": "Node16",
Copy link
Contributor Author

@alexprudhomme alexprudhomme Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only relevant changes in this PR is here. Changing these to Node16 is required for the types to be correctly inferred by typescript. Change this value also causes all relative imports to have a .js extension. More details here https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/InternalResolutionError.md

Copy link
Contributor Author

@alexprudhomme alexprudhomme Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason this is needed is because we use tsc to generate types and not a bundler. Therefore, we have to use moduleResolution as node16 to help typescript make the right resolutions. We can't use Bundler. Esbuild doesnt support generating types so this is our only option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

github-actions bot commented Sep 20, 2024

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 239.2 239.2 0
commerce 338.1 338.1 0
search 407.7 407.7 0
insight 392.7 392.7 0
recommendation 250.1 250.1 0
ssr 401.7 401.7 0
ssr-commerce 350.3 350.3 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
case-assist 0 6 0
insight 0 27 0
commerce 0 15 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

Base automatically changed from type=module-patch to type=module September 20, 2024 16:21
@alexprudhomme alexprudhomme changed the title fix headless type defintions chore(headless): fix internal resolution errors in node16 Sep 20, 2024
@alexprudhomme alexprudhomme marked this pull request as ready for review September 20, 2024 16:40
@alexprudhomme alexprudhomme requested review from a team as code owners September 20, 2024 16:40
@alexprudhomme alexprudhomme requested review from fpbrault, louis-bompart and fbeaudoincoveo and removed request for a team September 20, 2024 16:40
@louis-bompart louis-bompart added this to the V3 GA milestone Sep 23, 2024
alexprudhomme and others added 2 commits September 24, 2024 08:25
To be merged into #4442


Unit tests were failing because Jest has a hard time with ESM modules. I
tried to make it work but it ended up being easier to switch to vitest
altogether. The api are really really similar, it should not change how
we write tests.

## Headless-react unit tests are still failing it is addressed here - >
#4452

---------

Co-authored-by: Louis Bompart <[email protected]>
@alexprudhomme alexprudhomme merged commit 408b4ad into type=module Sep 24, 2024
2 checks passed
@alexprudhomme alexprudhomme deleted the type=module-headless-types branch September 24, 2024 12:30
alexprudhomme added a commit that referenced this pull request Sep 24, 2024
… headless (#4442)

https://coveord.atlassian.net/browse/KIT-3580

## Unit tests are failing. This is adressed
[here](https://github.com/coveo/ui-kit/pull/4449/files#diff-75f80b97846615f5b074710648b8191f74aa4f00fd1536c45bc344b284ca8e87),
once all PRs are approved we will merge in here

## [Publint](https://publint.dev/) status
- atomic : no errors
- headless: no errors
- atomic-react: no errors

## [Are the types wrong](https://arethetypeswrong.github.io/) status
- atomic : errors Internal resolution in node16 (Do we need to address
this ?) + cjs type warnings
- headless: errors Internal resolution in node16 ([addressed
here](#4445)) + cjs type warnings
- atomic-react: cjs type warnings

---------

Co-authored-by: Alex Prudhomme <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants