Code Monkey home page Code Monkey logo

Comments (4)

benmccann avatar benmccann commented on July 30, 2024

I just took a look at why you can't import $app/navigation. It's because it depends on the client singleton being available, which gets created when you call SvelteKit's start function, which hasn't been called in this case.

Here's the upstream issue: storybookjs/storybook#14952

from storybook-experimental-vite.

benmccann avatar benmccann commented on July 30, 2024

@michaelwooley are you still having difficulty with stores? I wasn't able to reproduce what you mentioned in #7 (comment)

I put the following in Header.svelte:

import { session } from '$app/stores';
console.log(`session ${session}`);
console.log(`$session ${$session}`);

It printed:

session [object Object]
$session [object Object]

from storybook-experimental-vite.

michaelwooley avatar michaelwooley commented on July 30, 2024

I am seeing the same message you reported in the terminal running storybook.

All of the errors that I am seeing only show up in the browser once you navigate to the header story (i.e. http://localhost:6006/?path=/story/header--basic).

Unfortunately, I'm still seeing the same errors that were popping up the other day (#7 (comment)).

I'm pretty certain that we're trying the same cases but here is a branch of what I've just tried just in case: https://github.com/michaelwooley/storybook-experimental-vite/compare/michael/import-session-store-demo


Poking around the code a bit, the failure appears to come up in .svelte-kit/runtime/app/stores.js:

	const stores = getContext('__svelte__');

	return {
		page: {
			subscribe: stores.page.subscribe

We never set the __svelte__ context. So stores is undefined.

from storybook-experimental-vite.

benmccann avatar benmccann commented on July 30, 2024

Most aliases are now supported out-of-the-box with the latest Storybook 7. You can see a summary of what is supported and not supported here: https://github.com/storybookjs/storybook/tree/next/code/frameworks/sveltekit

There are a few that are not yet supported and make more sense to support as mocks. I've created a new issue to track that: storybookjs/storybook#20999. PRs for it would be very welcome!

from storybook-experimental-vite.

Related Issues (6)

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.