-
-
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
npm run package
isn't playing nice without typescript
#2951
Comments
The error is unfortunate, maybe we can improve how it works when executing package for the first time. But you'll want to bundle d.ts even if your library is js, so that users importing it can benefit from the typings. cc @dummdidumm |
The error technically means that The option of disabling At least in my opinion. Edit: the other approach would be to include |
Strongly disagree, the average developer should have to opt out of generating type definition files, because publishing a package without type definitions is bad DX for everyone who uses your package and wants to have proper type definitions, be it for type checking against your public API or at least for better intellisense. What we should do is create a more meaningful error message, but I thought we did that already, so I'm a little surprised that the error presents itself like it does right now. |
I agree with the meaningful error message. I hear what you are saying about type definitions and bad DX. What I do like with Svelte & SvelteKit is how easy they both are to use, understand and get going with. The behaviour explained here is everything but that. Especially for new eyes coming to try exporting their code as a package. I'm personally fine with whatever solution we end up with, since I know this caveat now. I'm just raising the alarm for how weird this current behaviour actually is. |
Maybe we can
|
I think I don't think the question should be asked during the |
They could be using package managers other than npm and there's no easy way to detect those, #1646 (comment). Having a clear error message is the preferred way here, that's how other errors related to configuration are handled as they're only a one-time setup. |
Then we should intercept the current error message with something similar to: ”You can't package javascript modules without dependency |
After doing
So there's the message I expected present at the top of the error stack already - although I agree we can be wordier here with a link to the docs etc. I can't reproduce the case where you are only getting the |
I realize it is in the spirit of typescript to kind-of force everyone into using typescript by not being able to import non-typescript files without that stub, however, that extra wasted time combined with a compromise is the reason why I choose not to tolerate typescript on my side. Java and Eclipse did it right and I really enjoyed that back in the day, it was all optional and did nothing but help you out when you did improve the code. It will sound crazy but please consider my opinion, one has to research that and let it sink in and only then can we have rational view > It is not hard to link FB to the technocrats if you look into it. I know developers are very busy so I don't say much often. Don't their influence rub off is my opinion too though, ts today then what will it be tomorrow? In any event, Thanks svelte-kit! Disabling ts for now would be awesome. |
Describe the bug
Running
npm run package
on a code stack meant to spit out javascript modules (not typescript) gives us the error:Installning
svelte2tsx
makes it work, but it bundles.d.ts
-files.Reproduction
npm init svelte@next test
(Skeleton Project > No Typescript > Use ESLint > Use Prettier)
cd test; npm install
npm run package
Yields the error:
Cannot find package 'svelte2tsx'
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: