Skip to content

Commit

Permalink
Fix package duplication issues by aliasing all storybook packages (#160)
Browse files Browse the repository at this point in the history
Closes #50
Closes #157

This is the same fix as storybookjs/storybook#11092
  • Loading branch information
joshwooding authored Nov 19, 2021
1 parent b67015a commit 5100593
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/storybook-builder-vite/vite-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -31,6 +55,7 @@ module.exports.createViteServer = async function createViteServer(
resolve: {
alias: {
vue: 'vue/dist/vue.esm-bundler.js',
...storybookPaths
},
},
plugins: pluginConfig(options, 'development'),
Expand Down

0 comments on commit 5100593

Please sign in to comment.