rdfjs / types

Authoritative TypeScript typings for all RDFJS specifications
MIT License
17 stars 13 forks source link

Added type to export #36

Open TessavWalstijn opened 1 year ago

TessavWalstijn commented 1 year ago

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[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 2eafb739f515b0f4b096a162062f34fda77fa9d2

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 | Patch |

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 commented 1 year ago

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 commented 1 year ago

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 commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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 commented 6 months ago

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

Switching moduleResolution to: