4 ms·
Here an engineer at Ionic. You don't need to integrate typescript to use a "widget" generated with Stencil. Stencil is a compiler that generates vanilla web com
by manucorporat 9y ago
Here an engineer at Ionic. You don't need to integrate typescript to use a "widget" generated with Stencil. Stencil is a compiler that generates vanilla web components in javascript. You can just import the generated .js and use the component just like a "button" or native "input".
- ubersoldat2k7 9y agoGreat, that makes so much sense. But then, how about other dependencies that might come into play? For example, underscore, is that "packaged" with this generated JS file or some other way around? Thanks for the prompt response BTW.
- manucorporat 9y agoNo, Stencil.js is like a "real stencil", it is used to produce something, but it is not in the final product. There is nothing like "window.stencil" or any stencil related API in the output of the stencil compiler. It generates vanilla JS web components without dependencies. The documentation of stencil linked in this HN post was in fact created with stencil itself. Just open the Dev Tools!
- ubersoldat2k7 9y agoOK, so if I want to use a calendar Stencil (there will be lots of this for sure), which depends on Moment I would have to include Moment into my dependencies and manage all the dependency clashing (the stencil used 2.x but I'm using 1.x)
- manucorporat 9y agoIn fact we use the type information provided by typescript to generate the web component as performant as possible.
- arxpoetica 9y agoI think you should consider disassociating the TypeScript requirement in the compiler. You'll alienate developers (like me) who prefer Vanilla™ JavaScript. It's one of the things I love about Svelte (which you claim heritage to), in that they really try to conform to vanilla everything, i.e., HTML, CSS, JS. Everything else sounds terrific, though, especially the ability to do SSR.
- tobr 9y agoIt isn't really true that Svelte is just "vanilla" Javascript. For example, the compiler looks at the argument names of your computed properties to determine which data they depend on, which breaks with the semantics of Javascript. This means that Svelte only allows you to use function literals for computed properties.