Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte plugin: incompatibility with svelte-kit starting from 1.0.0-next.574 #392

Closed
6 tasks done
vnphanquang opened this issue Dec 9, 2022 · 3 comments
Closed
6 tasks done
Labels
to triage This issue needs to be triaged

Comments

@vnphanquang
Copy link

vnphanquang commented Dec 9, 2022

Describe the bug

Context

There have been 2 recent releases of svelte-kit that causes histoire to fail:

  1. 1.0.0-next.574, in which the internal vite-plugin-svelte-kit was split into vite-plugin-sveltekit-build and vite-plugin-sveltekit-middleware in PR #7990.

  2. 1.0.0-next.576, in which the sveltekit vite plugin became async (PR #7994).

Resolution

For (1), please see this open PR that updates viteIgnorePlugins.

For (2), I'm not sure there is a way to get around automatically from @histoire/plugin-svelte side; I'm happy to help out further if someone can give me some direction. For now, here is a working workaround for me:

// vite.config.ts/js

import { sveltekit } from '@sveltejs/kit/vite';
+ import { defineConfig } from 'vite';

/** @type {import('vite').UserConfig} */
+ const config = defineConfig(async () => ({
+       // await for for the new async `sveltekit` here
+	plugins: [await sveltekit()]
+ });

export default config;

Maybe if nothing can be done, then this should be added to the documentation somewhere?

Reproduction

Please run npm run story:dev from this StackBlitz. Notice:

  • verify that the startup site becomes the svelte-kit app instead of histore,
  • if svelte-kit is reverted to 1.0.0-next.573, everything works as expected.

System Info

❯ npx envinfo --system --npmPackages '{histoire,@histoire/*,vite,@vitejs/*}' --binaries --browsers
success Install finished in 1.829s


  System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @histoire/controls: 0.11.9 => 0.11.9 
    @histoire/plugin-svelte: 0.11.9 => 0.11.9 
    histoire: 0.11.7 => 0.11.7 
    vite: ^3.2.4 => 3.2.5 

(Ran from the same stackblitz above)

Used Package Manager

npm

Validations

@vnphanquang vnphanquang added the to triage This issue needs to be triaged label Dec 9, 2022
@stackblitz
Copy link

stackblitz bot commented Dec 9, 2022

@bivainis
Copy link

Can confirm, in my case I left Vite at v3, but updating to @sveltejs/kit@1.0.0-next.574 and running stories, visiting http://127.0.0.1:6006/ renders SvelteKit app instead of Histoire stories

@oneezy
Copy link

oneezy commented Dec 17, 2022

have you seen these fixes @bivainis ?
#393 (comment)

@Akryum Akryum closed this as completed in e7e5993 Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants