Closed indigolain closed 3 months ago
when will this pr be merged? waiting for this 👍
@indigolain Sorry my late feedback.
I attempt to build Storybook at the v8-vite
example but I got the following vite log.
=> Failed to build the preview
Error: [vite:load-fallback] Could not load ./node_modules/storycap/lib/client/with-screenshot (imported by .storybook/preview.js): ENOENT: no such file or directory, open './node_modules/storycap/lib/client/with-screenshot'
I think the log means the #856 issue is not solved.
@Quramy Thank you for reviewing my PR! The error you are getting is because the vite project that I setup expects storycap to be installed and present under node_modules ( this is where the config is applied).
Without setting this resolve.alias, when you try to build the storybook, it will result in throwing the following error.
=> Failed to build the preview
Error: [commonjs--resolver] Failed to resolve entry for package "storycap". The package may have incorrect main/module/exports specified in its package.json.
It seems that the commonjs--resolver
requires the storycap dependency to be inside package.json by default, unless you configure the resolver.
I've added a pre hooks to build-storybook for populating the storycap build with 5c26134749713445911a38a7f8aac5f817b5d805 to resolve the error you are getting, should this resolve the issue?
Thank you!!
May fix https://github.com/reg-viz/storycap/issues/856 ? Having import statements in a file makes
@rollup/plugin-commonjs
to skip the conversion from CommonJS to ES Module. Changing the import statement to require should make@rollup/plugin-commonjs
handle the file and successfully convert it.