Skip to content

Commit

Permalink
Add warning for super-addons not re-exporting their sub-addons
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Nov 8, 2022
1 parent b793868 commit 5bcd1e3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion code/lib/core-common/src/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const resolveAddonName = (
if (resolved) {
return {
type: 'presets',
name: resolved,
name,
};
}

Expand Down Expand Up @@ -201,6 +201,19 @@ export async function loadPreset(
const subPresets = resolvePresetFunction(presetsInput, presetOptions, storybookOptions);
const subAddons = resolvePresetFunction(addonsInput, presetOptions, storybookOptions);

// Addons that specify different sub-addons are a problem for vite with yarn pnp and pnpm
// Alert the user if an addon is using this pattern. We aren't positive what the final solution will be,
// maybe re-exporting as we do in addon-essentials, maybe something else. For now, we just want to add awareness.
if (
!name.startsWith('/') &&
subAddons.length &&
subAddons.some((subAddon) => !subAddon.startsWith('/') && !subAddon.startsWith(name))
) {
console.warn(
`Storybook addons that reference sub-addons by name are deprecated, but will continue to work in 7.0. Please check ${name}.`
);
}

return [
...(await loadPresets([...subPresets], level + 1, storybookOptions)),
...(await loadPresets(
Expand Down

0 comments on commit 5bcd1e3

Please sign in to comment.