slinkity / slinkity

To eleventy and beyond! The all-in-one tool for templates where you want them, component frameworks where you need them 🚀

Home Page:https://slinkity.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use JS/TS files without shortcodes?

svicalifornia opened this issue · comments

I'm trying to use Slinkity to compile and import TS (or TSX) files, as I would using Vite.

My Slinkity project structure is something like this:

src/
  index.html
  app/
    index.ts
    SomeComponent.tsx
    OtherStuff.ts
    ...etc

I've tried to load index.ts from index.html in a variety of ways:

<script src="/app/index.ts" type="module"></script>
<script src="/src/app/index.ts" type="module"></script>
<script src="../src/app/index.ts" type="module"></script>

…but the dev server 404's on all of those, and Rollup is unable to resolve any of those paths at build time.

Is it possible to reference a TS file like this, as I would in Vite, or are we limited to using shortcodes in Slinkity?

Hey @svicalifornia! That's interesting, because loading TS files should work exactly as Vite's documentation describes (even in Nunjucks or liquid files). Have you tried importing with an extension, i.e. src="/src/app/index"?

Checking if you still have the issue @svicalifornia. Give the 1.0 canary a try at https://slinkity.dev/docs/quick-start and let me know!