This storybook addon can be helpful to run a script inside your preview window by appending a script tag with your script content.

View on Github