We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I try to import using aliases, histoire throws following error
[plugin:vite:import-analysis] Failed to resolve import "$lib/images/github.svg" from "src/lib/components/button/button.svelte". Does the file exist? 20 | } from "svelte/internal"; 21 | 22 | import github from "$lib/images/github.svg"; // this throws error | ^ 23 | const file = "src/lib/components/button/button.svelte"; 24 |
It works fine when assets are imported using relative path. It seems to be not picking up the root level tsconfig.json
tsconfig.json
https://stackblitz.com/edit/sveltejs-kit-template-default-uc6vtd?file=package.json,src%2Flib%2Fcomponents%2Fbutton%2Fbutton.story.svelte,src%2Flib%2Fcomponents%2Fbutton%2Fbutton.svelte&terminal=dev
System: OS: Linux 5.0 undefined CPU: (8) 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/plugin-svelte: ^0.11.7 => 0.11.7 histoire: ^0.11.7 => 0.11.7 vite: ^3.1.0 => 3.2.4
npm
The text was updated successfully, but these errors were encountered:
Start a new pull request in StackBlitz Codeflow.
Sorry, something went wrong.
I can confirm! @bhvngt maybe passing an alias to vite through your config may help:
// histoire.config.ts import { defineConfig } from 'histoire'; import { HstSvelte } from '@histoire/plugin-svelte'; export default defineConfig({ plugins: [HstSvelte()], setupFile: './histoire.setup.ts', vite: { resolve: { alias: { '$lib': 'src/lib' } } } });
Thanks @SzudemJ . I have used this as a workaround and can confirm that it is working out fine for me.
I hope this will be fixed if we leave SvelteKit's setup plugin in place and remove it's compile plugin. See my comment here: #393 (comment)
No branches or pull requests
Describe the bug
When I try to import using aliases, histoire throws following error
It works fine when assets are imported using relative path. It seems to be not picking up the root level
tsconfig.json
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-uc6vtd?file=package.json,src%2Flib%2Fcomponents%2Fbutton%2Fbutton.story.svelte,src%2Flib%2Fcomponents%2Fbutton%2Fbutton.svelte&terminal=dev
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: