Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

vasileermicioi/parcel-storybook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parcel-storybook

full storybook (preview + manager including addons!) bundled by parceljs instead of webpack

features (thanks to parceljs :) )

  1. zero config react + typescript support (no babel, no webpack or any other config)
  2. glob import all stories (*.stories.ts), see ./storybook/iframe.ts
  3. fast bundling -- fast storybook preview bundling thanks to parceljs -- storybook manager prebuilt and included in git (approach used by snowpack and yarn 2 cache sharing), so no time spent to build it

usage

git clone https://github.com/vasileermicioi/parcel-storybook
cd parcel-storybook
yarn install
yarn storybook

storybook manager rebuild

if you need more addons (now only actions and knobs) you can modify ./storybook/config/main.js

yarn rebuild-manager
yarn storybook

!! don't forget to commit newly generated files !! rebuild manager only when you need to change manager config, not the preview or stories

motivation

storybook published a standalone preview powered by parceljs (see here https://github.com/storybookjs/storybook/tree/next/examples/standalone-preview) but the example is not working with the addons because the preview is inside an iframe with different origin, (see here storybookjs/storybook#8677) cross-origin requests/communication being blocked by browsers (same domain but different port is considered another origin)

running storybook with parceljs (because of it's simplicity) seems to be a popular request storybookjs/storybook#10110 storybookjs/storybook#8677 storybookjs/storybook#5975 (comment)

posible solutions

main problem is to fix cross-origin communication, I was able to solve that in 2 ways

  1. reverse proxy both the manager and the preview so they are in the same domain
  2. build static manager (how often are you changing storybook config?) and serving / watching only the preview having storybook manager as static assets

so current repo is solved using second approach

About

storybook powered by parceljs instead of webpack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published