Open AndreiSoroka opened 1 year ago
For webpack my solutions was:
storybook/.storybook/main.js
const path = require('path');
module.exports = {
stories: [
'../../src/**/*.stories.mdx',
'../../src/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-interactions',
'storybook-addon-designs',
],
framework: '@storybook/vue3',
core: {
builder: 'webpack5',
},
webpackFinal: async (config) => {
config.resolve = {
alias: {
vue: 'vue/dist/vue.esm-bundler.js',
},
modules: [
path.resolve(__dirname, '../../node_modules'),
path.resolve(__dirname, '../node_modules')
],
};
config.module.rules.push(
{
test: /\.scss$/,
include: path.resolve(__dirname, '../../'),
use: [
'style-loader',
'css-loader',
'sass-loader',
],
},
);
// support import ts files
if (config.resolve.extensions) {
config.resolve.extensions.push('.ts');
} else {
config.resolve.extensions = [
'.ts',
'.mjs',
'.js',
'.jsx',
'.vue',
'.json',
'.wasm',
]
}
// support alias @
config.resolve.alias['@'] = path.resolve(__dirname, '../../src');
return config;
},
}
Is your feature request related to a problem? Please describe
I'm always frustrated when in a project I have 100500 dependencies, and of course when they have collisions. And of course, when any library has warnings or npm audit problems
Describe the solution you'd like
I want the storybook to be able to work from outside the project or from a subfolder. Like a separate project. And i want to find this setting when installing storybook
Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
limited, but yes, I can
Additional context
I can provide my solution
Vite:
module.exports = { root: true, overrides: [ { files: [ '*/.stories.[jt]s', ], extends: [ "plugin:vue/vue3-essential", "eslint:recommended", "@vue/eslint-config-typescript", "@vue/eslint-config-prettier", "plugin:storybook/recommended", ], parserOptions: { ecmaVersion: "latest", }, rules: { 'import/no-extraneous-dependencies': 'off', }, }, ], };
and need to add in a root package.json
module.exports = { stories: [ '../../src/*/.stories.mdx', '../../src/*/.stories.@(js|jsx|ts|tsx)', ], addons: [ '@storybook/addon-links', '@storybook/addon-essentials', // '@storybook/addon-a11y', // '@storybook/addon-interactions', // 'storybook-addon-designs', ], "framework": "@storybook/vue3", "core": { "builder": "@storybook/builder-vite" }, "features": { "storyStoreV7": true }, async viteFinal(config, {configType}) { return mergeConfig(config, { resolve: { alias: { "@": path.resolve(__dirname, "../../src",), }, }, }); }, }