Code Monkey home page Code Monkey logo

histoire-sveltekit's Introduction

Histoire + SvelteKit + TS + Vitest + Tailwind CSS

Template repository for new projects with support to Histoire, SvelteKit, Typescript, Plop, Vitest and Tailwind CSS.

Usage

  1. Above the file list for this template, click Use this template.

Read more here about Creating a repository from a template.

Run Histoire

# Install the project dependencies.
npm run install # or pnpm install

# Run Histoire
npm run story # pnpm story

Create a new component

It makes use of plopjs to scaffold all the files (definition, test suite, story) for a new component.

npm run plop (or pnpm plop)

License

Free and open-source software under the MIT License

histoire-sveltekit's People

Contributors

indaco avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

siva-kubikk

histoire-sveltekit's Issues

Unable to use Sveltekit modules in components (i.e. $path)

When trying to import Sveltekit Modules such as the $path store in a component,

❌ I get an error in Histoire (port 6006)
✅ I don't get an error in Sveltekit (port 5173).


Example: a component that displays the <URLpath />
Output: "indaco/histoire-sveltekit/issues/2"

<!-- URLpath.svelte -->
<script>
  import { page } from '$app/stores'
</script>

<span>{$page.url.pathname}</span>
sveltekit-histoire-bug.webm

Error

image

> oneezy@oneezy MINGW64 ~/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro (main)
$ pnpm story

> [email protected] story C:\Users\oneezy\Desktop\www\10.Repros\indaco-histoire-sveltekit-repro
> svelte-kit sync && histoire dev

  ➜  Local:   http://localhost:6006/
  ➜  Network: use --host to expose
Collect stories start all
Failed to resolve import "$app/stores" from "src\lib\components\URLpath\URLpath.svelte". Does the file exist?
Error while collecting story C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/src/stories/URLpath/URLpath.story.svelte:
Error: Failed to resolve import "$app/stores" from "src\lib\components\URLpath\URLpath.svelte". Does the file exist?
    at formatError (file:///C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:40854:46)
    at TransformContext.error (file:///C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:40850:19)
    at normalizeUrl (file:///C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:37587:33)
    at async TransformContext.transform (file:///C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:37720:47)
    at async Object.transform (file:///C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:41103:30)
    at async loadAndTransform (file:///C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:37365:29)
Collect stories end 3952 ms
The request url "C:/Users/oneezy/Desktop/www/2.Starters/monorepo/node_modules/.pnpm/@[email protected][email protected]/node_modules/@histoire/app/dist/bundle-main.js" is outside of Vite serving allow list.

- C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.pnpm/@[email protected][email protected]/node_modules/@histoire/app/dist
- C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro/node_modules/.histoire
- C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro
- C:/Users/oneezy/Desktop/www/10.Repros/indaco-histoire-sveltekit-repro

Refer to docs https://vitejs.dev/config/server-options.html#server-fs-allow for configurations and more details.

🐛 Histoire Bug ➡️ LinkError: WebAssembly.instantiate()

Hey there @indaco !
I was checking out your histoire-sveltekit template and noticed this bug.

src-stories-button-button-story-svelte:1
- Uncaught (in promise) LinkError: WebAssembly.instantiate(): Import #4 module="env" function="setTempRet0" error: function import requires a callable

Any idea on what the problem could be?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.