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

fix(pinia-orm): proper exports for collection and uid helpers #1681

Merged
merged 1 commit into from Sep 18, 2023
Merged

fix(pinia-orm): proper exports for collection and uid helpers #1681

merged 1 commit into from Sep 18, 2023

Conversation

daniser
Copy link
Contributor

@daniser daniser commented Sep 18, 2023

πŸ”— Linked issue

#1680

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves #1680.
All imports are now possible without specifying dist folder.
For those who used dist and it worked for them - it should still work too (I think).
Docs updated accordingly (all dist references removed).

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (377f449) 99.84% compared to head (0964dba) 99.84%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1681   +/-   ##
=======================================
  Coverage   99.84%   99.84%           
=======================================
  Files          86       86           
  Lines        5873     5873           
  Branches      494      494           
=======================================
  Hits         5864     5864           
  Misses          6        6           
  Partials        3        3           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@CodeDredd CodeDredd added the bug Something isn't working label Sep 18, 2023
@CodeDredd CodeDredd merged commit ab5e245 into CodeDredd:master Sep 18, 2023
8 checks passed
@daniser
Copy link
Contributor Author

daniser commented Sep 18, 2023

@CodeDredd

For those who used dist and it worked for them - it should still work too (I think).

So, I was wrong about that. Rollup has failed when I tried to import helpers the "old way" (with dist).
To preserve BC, we can add safeguard like this (and remove it in v2.0):

"./dist/*": {
  "types": "./dist/*.d.ts",
  "require": "./dist/*.cjs",
  "import": "./dist/*.mjs"
},
"./*": {
  "types": "./dist/*.d.ts",
  "require": "./dist/*.cjs",
  "import": "./dist/*.mjs"
}

WDYT?

@CodeDredd
Copy link
Owner

CodeDredd commented Sep 18, 2023

yes i think the same. Just had the same issue....also types dont work without "dist" correctly

@daniser
Copy link
Contributor Author

daniser commented Sep 18, 2023

also types dont work without "dist" correctly

That's weird. Modern versions of TS know how to parse exports section of package.json.
What version of TypeScript and which module resolution strategy do you use?

@CodeDredd
Copy link
Owner

CodeDredd commented Sep 18, 2023

also types dont work without "dist" correctly

That's weird. Modern versions of TS know how to parse exports section of package.json. What version of TypeScript and which module resolution strategy do you use?

I am using TS 5.2.2 and "moduleResolution": "node". So all fine.
I still remember that i spent hours when i made this package why typscript can't resovle the aliases. I don't know why. I just know that 'dist' works.

I think i have to create the folders with an index.ts file like "decorators/index" in the root. I think that then it will work.

@daniser
Copy link
Contributor Author

daniser commented Sep 18, 2023

I am using TS 5.2.2 and "moduleResolution": "node". So all fine. I still remember that i spent hours when i made this package why typscript can't resovle the aliases. I don't know why. I just know that 'dist' works.

I think i have to create the folders with an index.ts file like "decorators/index" in the root. I think that then it will work.

FYI: I found out that it's most likely node strategy which is outdated and shouldn't be used in modern code. I actually tested it in my project. node16/nodenext/bundler worked fine, but when I changed moduleResolution to node, types stopped working.

Your idea with folders sounds fine if Pinia ORM really need to support legacy versions of Node... which I think not supported currently anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module resolution failure for collection and uid helpers
3 participants