-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Imports broken with library updated to svelte-package v2 #9114
Comments
Please provide a reproduction repository (a link to your library is enough for me) |
@dummdidumm Done. I just wanted to get the issue number. |
I was unable to reproduce this, running How are you installing your test package? |
This is a similar problem to what I'm running into:
With TS not really being able to do subpath export handling very well (microsoft/TypeScript#33079) - that |
@sureshjoshi Would be interested to see why you are running into issues as well, still unable to reproduce any runtime or type errors |
I've worked around most of mine, there are a number of small issues which result in a comedy of errors. I should note, in my case, it's a bit stranger, as I want to allow certain subdirectories and no top-level imports, so not a 1:1 with this ticket. https://github.com/robotpajamas/svelte-heroicons/tree/2.x Actually, for me, what I would like is to flatten the output package, so that the package.json is at the same level as my I'm not sure if that's a configuration change, or if I should copy/paste package.json into the And note: The ONLY reason I want to do this is because of the poor TS support for subpaths, as per the attached issue above. If I could map by subpaths and have them show up in intellisense, I'd be perfectly happy. |
The svelte package behaviour changed so that it no longer will generate a package.json in the I personally haven't run into poor support of paths in ts like you describe so can't help there unfortunately |
Yep, that's what I understood from the #8825 discussion (or maybe the svelte-package docs). So, looking to try and re-create that behaviour for this icons package. Or in general, figuring out some way to flatten away the intermediate |
Ah yeah that's a bummer that TS is not playing ball (it would with TS 5.0 and |
I've been trying this today, but what does "publish from there" mean in this context. Like, just jump into |
... My head is going to explode. Yep, it was that simple 🤦🏽 Thanks @dummdidumm ! |
Yes:
(part 1 could be automated - the copy thing, not sure about the |
It also works with |
and explain that stuff in the docs closes #9114
FYI I found a better solution to this which keeps us from introducing a fragile copy function: (ab)using the {
"typesVersions": {
">4.0": {
"Button.svelte": ["./dist/Button.svelte.d.ts"]
}
}
}
|
and explain that stuff in the docs closes #9114
After doing this, has anyone lost TS intellisense in VSCode? I can't seem to get VSCode to see my svelte or .ts modules after I've used When I use the instructions above to publish from the As soon as I try to use |
@sureshjoshi can you give a more concrete example? I just pulled down your master branch of import {} from '@robotpajamas/svelte-heroicons';
import { AcademicCapIcon } from '@robotpajamas/svelte-heroicons/solid';
import { AcademicCap } from '@robotpajamas/svelte-heroicons/solid/AcademicCap';
import Cap from '@robotpajamas/svelte-heroicons/solid/AcademicCap/AcademicCap.svelte'; Do you mean that there's no path autocompletion? E.g. you do |
Hey @dummdidumm - if this is the version where I removed I'll try to make a breaking branch shortly, but the path completion works - but I get all the red squiggles, even though path completion works, and the code compiles/transpiles/runs just fine. |
I ran the migration script on your master branch and used the outcome (including the |
https://github.com/RobotPajamas/svelte-heroicons/tree/sketchy-ts-support Workflow is:
From another repo where I use the icons:
And then I get this in VSCode: If I'm not mistaken, the only real changes are using Note: I also did whatever TS/Svelte server restarts I could, reboots, etc - still no types. |
Oh, interesting, after npx migrate, it enumerates ALL of the files and doesn't use the wildcard format. Fascinating, I might need to look into this more. From the docs, I was under the impression that |
Thanks, here's the things I found:
So a more correct version would look like this: "typesVersions": {
"*": {
"*": [
"package/*"
]
}
} That works, but now you export more than you like (judging from your exports map), because you want only the index files exposed. So the final version is: "typesVersions": {
"*": {
"index": [
"./package/index.js"
],
"mini": [
"./package/mini/index.d.ts"
],
"mini/*": [
"./package/mini/*/index.d.ts"
],
"outline": [
"./package/outline/index.d.ts"
],
"outline/*": [
"./package/outline/*/index.d.ts"
],
"solid": [
"./package/solid/index.d.ts"
],
"solid/*": [
"./package/solid/*/index.d.ts"
]
}
} |
Hmm, interesting - I didn't use the migration script, so I don't have However, I will try what you suggested re: typesVersions. I've tried about 100 permutations over the last week, so hard to recall what I've tried and not tried 😮💨 Looking at my sample branch, I actually think I made a mistake. The attempt I thought would work should look like this (still didn't work, so 🤷🏽).
In any case, will try your version later today and report back! |
huh, nevermind about |
With tomorrow's TS v5 release, does the recommended fix change? Would prefer not to have to litter my |
Btw, getting 2 warnings after
|
Describe the bug
I updated a lib to use svelte-package v2.
Previously I was using the lib like this:
After updating I get an error from TS that the module does not exist.
I found that if I add the output directory to the import, then it works:
Example:
I'm not sure where the issue is here, I used the migration script and have gone through this doc.
Reproduction
https://github.com/seanlail/kit-issue-9114
Logs
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: