diff --git a/packages/storybook-builder-vite/vite-server.js b/packages/storybook-builder-vite/vite-server.js index db1d7ea9..713c849b 100644 --- a/packages/storybook-builder-vite/vite-server.js +++ b/packages/storybook-builder-vite/vite-server.js @@ -4,6 +4,30 @@ const { optimizeDeps } = require('./optimizeDeps'); const { createServer } = require('vite'); const { pluginConfig } = require('./vite-config'); +const storybookPaths = [ + 'addons', + 'api', + 'channels', + 'channel-postmessage', + 'components', + 'core-events', + 'router', + 'theming', + 'semver', + 'client-api', + 'client-logger', + 'preview-web', + 'store', +].reduce( + (acc, sbPackage) => ({ + ...acc, + [`@storybook/${sbPackage}`]: path.dirname( + require.resolve(`@storybook/${sbPackage}/package.json`) + ), + }), + {} +); + module.exports.createViteServer = async function createViteServer( options, devServer @@ -31,6 +55,7 @@ module.exports.createViteServer = async function createViteServer( resolve: { alias: { vue: 'vue/dist/vue.esm-bundler.js', + ...storybookPaths }, }, plugins: pluginConfig(options, 'development'),