Skip to content
New issue

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

Add .storybook to server.fs.allow #427

Merged
merged 4 commits into from
Jul 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/builder-vite/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ export async function pluginConfig(options: ExtendedOptions, _type: PluginConfig
// Do not treat story files as HMR boundaries, storybook itself needs to handle them.
exclude: [/\.stories\.([tj])sx?$/, /node_modules/].concat(framework === 'react' ? [] : [/\.([tj])sx?$/]),
}),
{
name: 'vite-plugin-storybook-allow',
enforce: 'post',
config(config) {
// if there is no allow list then Vite allows anything in the root directory
// if there is an allow list then Vite allows anything in the listed directories
// add the .storybook directory only if there's an allow list so that we don't end up
// disallowing the root directory unless it's already disallowed
if (config?.server?.fs?.allow) {
benmccann marked this conversation as resolved.
Show resolved Hide resolved
config.server.fs.allow.push('.storybook');
}
},
},
] as Plugin[];
if (framework === 'vue' || framework === 'vue3') {
try {
Expand Down