Thanks a lot for sharing this info! Does anyone know how to configure the storybook main.cjs file in order to make an alias work? This is how I've set up an alias in vitejs
vite.config.cjs
export default defineConfig({ plugins: [svelte()], server: { fs: { allow: ['..'] } }, resolve: { alias: [ { find: '@', replacement: '/.../my-app/src', } ] }, ... })
ah, found it:
module.exports = { "stories": [ "../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx|svelte)" ], "addons": [ "@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-svelte-csf" ], "core": { "builder": "storybook-builder-vite" }, "svelteOptions": { "preprocess": require("../svelte.config.cjs").preprocess }, async viteFinal(config) { config.resolve.alias = { "@": "/.../my-app/src", }; return config; } }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks a lot for sharing this info!
Does anyone know how to configure the storybook main.cjs file in order to make an alias work?
This is how I've set up an alias in vitejs
vite.config.cjs
ah, found it: