Open ryuran opened 1 year ago
Workaround: avoid arrow function and prefer anonymous function
template: function (args) {
return /* html */ `
<ce-avatar
size="${args.size}"
${args.color ? `color='${args.color}'` : ''}
${args.type === 'picture' ? `src="assets/images/avatars/29.jpg"` : ''}
${args.type === 'initials' ? `initials="${args.initials}"` : ''}
></ce-avatar>
`;
},
Hello,
I have some silent fails when the template is a function. From this try/catch :
https://github.com/naver/storybook-addon-preview/blob/master/src/PreviewPanel.tsx#L66-L70
It happen only on built storybook. When it's served for dev it doesn't happen. I suspect Terser/Babel or something else to alter the function making it unable to be stringified properly.
I didn't identified why some functions fails and some others not. It seems to fail more often for direct return arrow function :