storybook
storybook copied to clipboard
[Bug]: Init fails when using appTemplate or routes config w/ @storybook/sveltekit
Describe the bug
When using appTemplate
and routes
in storybook.config.js
, @storybook/sveltekit
cannot find files from the storybook directory.
However, when using the standard config, everything works as expected.
Storybook MUST pick up the route and template configs from story storybook.config.js
to be viable for production codebases.
Production code for large organizations tends to have more deeply nested directories and use non-standard configurations to provide separation between server code, web code, service integrations, and so on.
To Reproduce
-
Create a SvelteKit project with the following config for Svelte and Vite:
// svelte.config.js const config = { kit: { files: { routes: './web/routes', appTemplate: './web/app.html' } } }; export default config;
import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig, searchForWorkspaceRoot } from 'vite'; export default defineConfig({ plugins: [sveltekit()], server: { fs: { allow: [searchForWorkspaceRoot(process.cwd())] } } });
-
Run
npx sb init
You will then see a message like:
The request url "/home/user/my-repo/stories/Configure.mdx" is outside of Vite serving allow list.
System
System:
OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1270P
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 21.2.0 - ~/.nvm/versions/node/v21.2.0/bin/node
npm: 10.2.3 - ~/.nvm/versions/node/v21.2.0/bin/npm <----- active
npmPackages:
@storybook/addon-essentials: ^7.6.11 => 7.6.11
@storybook/addon-interactions: ^7.6.11 => 7.6.11
@storybook/addon-links: ^7.6.11 => 7.6.11
@storybook/blocks: ^7.6.11 => 7.6.11
@storybook/svelte: ^7.6.11 => 7.6.11
@storybook/sveltekit: ^7.6.11 => 7.6.11
@storybook/test: ^7.6.11 => 7.6.11
storybook: ^7.6.11 => 7.6.11
Additional context
No response