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

Added type to export #36

Merged
merged 9 commits into from
Dec 5, 2024
Merged

Added type to export #36

merged 9 commits into from
Dec 5, 2024

Conversation

TessavWalstijn
Copy link
Contributor

Moving from Webpack 4 to Vite 4.

When we build our application we get the error that Vite:

✘ [ERROR] Could not resolve "./data-model"

    node_modules/@rdfjs/types/index.d.ts:3:14:
      3 │ export * from './data-model';
        ╵               ~~~~~~~~~~~~~~

✘ [ERROR] Could not resolve "./stream"

    node_modules/@rdfjs/types/index.d.ts:4:14:
      4 │ export * from './stream';
        ╵               ~~~~~~~~~~

✘ [ERROR] Could not resolve "./dataset"

    node_modules/@rdfjs/types/index.d.ts:5:14:
      5 │ export * from './dataset';
        ╵               ~~~~~~~~~~~

✘ [ERROR] Could not resolve "./query"

    node_modules/@rdfjs/types/index.d.ts:6:14:
      6 │ export * from './query';
        ╵               ~~~~~~~~~

I was able to solve the issue locally by editing the index.d.ts from this package.

I hope with this change to make rdfjs accessible for Vite users as well.

@changeset-bot
Copy link

changeset-bot bot commented May 26, 2023

🦋 Changeset detected

Latest commit: 611ba01

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rdfjs/types Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tpluscode
Copy link
Contributor

Hm, having used vite myself, I have not experience such an issue. Could you share your project or a minimal reproduction so that I can understand what's happening here?

@TessavWalstijn
Copy link
Contributor Author

Hm, having used vite myself, I have not experience such an issue. Could you share your project or a minimal reproduction so that I can understand what's happening here?

Sure I will try to reproduce the issue.

@tpluscode
Copy link
Contributor

Oh, I came back here looking at some other PRs and I think I realise that your problem is probably with TS module resolution.

I think a more robust improvement would be to add .js extension to imports/exports

@TessavWalstijn
Copy link
Contributor Author

Cool!

Sorry haven't come around it to create a simple way to reproduce my issue.

I might be able to spend some time to try your solution with the next upgrade cycle.

@tpluscode
Copy link
Contributor

Sorry haven't come around it to create a simple way to reproduce my issue.

So, expanding on my comment above, I expect you should be able to reproduce when you set moduleResolution to Node16 or NodeNext.

@TessavWalstijn
Copy link
Contributor Author

Hi hi so I was able to create a minimal reproduction:
https://github.com/TessavWalstijn/vue2-ts.rdfjs-types-issue

Switching moduleResolution to:

  • Node10 original
  • Node16
  • NodeNext
    Did not resolve the issue.

@tpluscode
Copy link
Contributor

tpluscode commented Nov 19, 2024

HI @TessavWalstijn, sorry for dropping the ball on this. I just checked your repro and just changing exports to export type * was enough for the errors to go away using the installed TS v5.1.6

That would be more appropriate that re-exporting all named exports which will likely lead to isses when we forget to include new types.

That said, export type * was only introduced in TS5. @jeswr @rubensworks would you consider adding this as breaking change and including in v2 of the types? #46 is already aiming to start a major release...

@rubensworks
Copy link
Member

That said, export type * was only introduced in TS5. @jeswr @rubensworks would you consider adding this as breaking change and including in v2 of the types? #46 is already aiming to start a major release...

Sounds good to me!

@jeswr
Copy link
Contributor

jeswr commented Nov 19, 2024

Sounds good to me too!

@TessavWalstijn
Copy link
Contributor Author

TessavWalstijn commented Nov 20, 2024

HI @TessavWalstijn, sorry for dropping the ball on this. I just checked your repro and just changing exports to export type * was enough for the errors to go away using the installed TS v5.1.6

Yeah no problem I can update the PR.

So for some reason I bummed in to this issue: 'Only named exports may use "export type".'
And resolved that like the following:
Resolved 'Only named exports may use "export type".' issue

Looking back my original commit it is like you propose @tpluscode
Added type to export

I can update it back to the original. So you can use it in the v2 branch.

Ping me if there is the need to update the base branch to v2 when that exists.

@tpluscode
Copy link
Contributor

So for some reason I bummed in to this issue: 'Only named exports may use "export type".'

Maybe that was reported by the CI as you can see in the failed run

Please update the dependency to ^5 for typescript

.changeset/mighty-icons-sleep.md Outdated Show resolved Hide resolved
@tpluscode
Copy link
Contributor

Uh, why is the CI running yarn. Please update your branch once more when #54 is merged

@tpluscode tpluscode merged commit d66a6e6 into rdfjs:master Dec 5, 2024
3 checks passed
@tpluscode tpluscode mentioned this pull request Dec 20, 2024
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.

4 participants