Builder vs Framework Precedence in Storybook 7 – Which Setting Wins?
0 reputation · 22 Nov 2024, 13:56 UTC
The framework key in main.js declares the UI framework (e.g., react, vue) and implicitly pulls in a compatible builder. The builder key can override that default, but the documentation marks it as deprecated and hints that the framework should be the source of truth.
When both keys are present, users report inconsistent behavior: some see the explicit builder win, others observe the framework’s default prevail, and in custom framework scenarios the builder property appears ignored unless framework is set to storybook. Add‑ons that require a specific builder also seem to influence the final selection.
Because the official docs do not state the exact precedence order and newer releases (e.g., 7.2+) may have altered the logic, the community lacks a definitive answer.
Questions to resolve the uncertainty:
- Does specifying
builder: 'vite'always override the default builder provided by the framework, regardless of order? - In a project that uses a custom framework without a bundled builder, is the
builderproperty ignored unlessframeworkis set tostorybook? - How do addon requirements (e.g., @storybook/addon‑essentials) affect builder selection when both
frameworkandbuilderare defined?