Open datsenkoboos opened 1 year ago
@hirotaka - we don't seem to have access to setup
in this addon. We can't get our modules (Pinia, FormKit) to work because of this.
Is there any way to get this to work?
Any solutions how to remove this error?
+1 would like to know a solution to this issue...
It isn't specifically tied to Pinia
. The error shows up with an empty setup
function as well:
setup((app: App) => {
})
Same for me, does anyone have any idea how to fix it? @hirotaka
As a temporary workaround, the error can be avoided by adding an optional chain like so:
node_modules/@storybook/vue3/dist/index.mjs
import { renderToCanvas, decorateStory, render } from './chunk-SRVBJOBI.mjs';
export { setup } from './chunk-SRVBJOBI.mjs';
import { global } from '@storybook/global';
import { start } from '@storybook/preview-api';
var { window: globalWindow } = global;
globalWindow.STORYBOOK_ENV = "vue3";
var RENDERER = "vue3",
api = start(renderToCanvas, { decorateStory, render }),
storiesOf = (kind, m) =>
api.clientApi.storiesOf(kind, m).addParameters({ renderer: RENDERER }),
configure = (...args) => api.configure(RENDERER, ...args),
{ forceReRender } = api,
{ raw } = api.clientApi;
// typeof module < "u" && module?.hot?.decline();
typeof module < "u" && module?.hot?.decline?.(); // add here
export { configure, forceReRender, raw, storiesOf };
In order to keep the fix, you can use the patch-package.
Install
yarn add -D patch-package
Add script to package.json:
"scripts": {
+ "postinstall": "patch-package"
}
Add the fix above to the node_modules/@storybook/vue3/dist/index.mjs
and create patch:
npx patch-package @storybook/vue3
As a temporary workaround, the error can be avoided by adding an optional chain like so:
node_modules/@storybook/vue3/dist/index.mjs
import { renderToCanvas, decorateStory, render } from './chunk-SRVBJOBI.mjs'; export { setup } from './chunk-SRVBJOBI.mjs'; import { global } from '@storybook/global'; import { start } from '@storybook/preview-api'; var { window: globalWindow } = global; globalWindow.STORYBOOK_ENV = "vue3"; var RENDERER = "vue3", api = start(renderToCanvas, { decorateStory, render }), storiesOf = (kind, m) => api.clientApi.storiesOf(kind, m).addParameters({ renderer: RENDERER }), configure = (...args) => api.configure(RENDERER, ...args), { forceReRender } = api, { raw } = api.clientApi; // typeof module < "u" && module?.hot?.decline(); typeof module < "u" && module?.hot?.decline?.(); // add here export { configure, forceReRender, raw, storiesOf };
In order to keep the fix, you can use the patch-package.
Install
yarn add -D patch-package
Add script to package.json:
"scripts": { + "postinstall": "patch-package" }
Add the fix above to the
node_modules/@storybook/vue3/dist/index.mjs
and create patch:npx patch-package @storybook/vue3
Thank you!!!!
Error:
Description:
Error appears only when using
storybook-addon-nuxt
withsetup
from'@storybook/vue3'
insidepreview.ts
. Error doesn't appear, when usingstorybook-addon-nuxt
andsetup
separately.preview.ts:
main.ts:
[Temporary solution](https://github.com/hirotaka/storybook-addon-nuxt/issues/18#issuecomment-1663173967) (for pnpm users: do not install `patch-package`, just use `pnpm patch`)