Thoughts on using Typescript and SvelteKit's package
command?
#250
Closed
jrmoynihan
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
I'm sorry for just seeing this discussion now. The v4 version has already been built with SvelteKit. Thank you! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there @Cweili , I've noticed that a fair number of the issues that arise in this package are the result of imported/exported members and their type definitions, especially when using SvelteKit. Presumably, this is related to the ESM-centric model that Vite uses. I don't think the
svelte-fa
package exports all of its components as modules in the package.json.I was wondering if you've considered adding Typescript directly to the component's script tags (not just the type definitions) and using SvelteKit's built-in
package
command to help reliably generate & manage the exported types and component exports for you. It automatically generates the type definition files for your components upon build, and importantly it adds the entry points of the components in thepackage.json
(under the"exports"
field). I think this is related to some of the auto-import & namespace issues people encounter when building withsvelte-fa
in Kit. It also defaults the"svelte"
field inpackage.json
to'./index.js'
rather than'src/fa.svelte'
, which would probably solve the default import case as intended. Likewise, the generatedpackage.json
uses"type":"module"
to indicate that all exports are considered ES modules, which is what Vite/Kit expects.It seems like the simple solution might just be to use this package-building tool the Svelte team designed to streamline the process for you.
I've already tried migrating over to the Kit
package
method in my fork, if you want to take a look. I also removed what appeared to be redundant tools/files related to the build process (e.g. Rollup config is built-in as a plugin to the Kit build step), and added a few types that were not emitted/exported (e.g. FlipDirection and PullDirection). It probably needs to have the tests added back in, however.Let me know what you think?
Beta Was this translation helpful? Give feedback.
All reactions