#commonjs--resolver error when building Storybook 7 with addon-docs using Vite/Rollup

4 messages · Page 1 of 1 (latest)

woven sequoia
#

I'm in the process of upgrading from Storybook 6 with Webpack 5 to Storybook 7 with Vite.
When running Storybook with storybook dev, the build succeeds and the Storybook UI displays correctly.

However, when building Storybook with storybook build, I receive an error that seems to be coming from Rollup and related to @storybook/addon-docs.

My understanding is that Vite uses esbuild for development builds, and rollup for production builds, which would explain a difference between the behaviour of storybook dev versus storybook build.

Attached is the log produced by storybook build.

I've tried searching for github issues on the Storybook, Rollup, and Vite repos related to this, but haven't been able to find this particular error. Any assistance would be greatly appreciated.

woven sequoia
#

I can confirm that if I remove usages of @storybook/addon-docs, the build succeeds.

#

I've further narrowed down to specifically one file that uses @storybook/addon-docs. Other usages of the addon do not cause the error.

At this point, I think it's likely I'll solve this myself. I'll mark this as resolved if I discover the solution, or respond if I get stumped again.