Hello! I'm working with SvelteKit 1.0 and Storybook 7 Beta 25 and I'm trying to get aliased imports working.
In some of my components I include other components from, say, $lib/components where $lib = ./src/lib/. However while these imports work fine in my actual app, Storybook is not able to resolve them.
I tried adding the alias explicitly in my main.cjs file to no avail:
framework: {
name: '@storybook/sveltekit',
options: {}
},
async viteFinal(config, { configType }) {
return mergeConfig(config, {
resolve: {
alias: {
$lib: path.resolve('../src/lib')
}
}
});
},
This does make it resolve the import but it doesn't actually work:
Failed to load url /abs-path-to-my-project/src/lib/components/MyComponent/MyComponent.svelte (resolved id: /abs-path-to-my-project/src/lib/components/MyComponent/MyComponent.svelte). Does the file exist?
This file does exist at that exact absolute path as well, so I'm not sure what's going wrong.
Is this just broken at the moment or is there anything to do to make it work?