sourcegraph/client/storybook
Quinn Slack de613e92b6
use esbuild for client/web builds (#57365)
Use [esbuild](https://esbuild.github.io/) instead of Webpack for builds of `client/web`, for faster builds (dev and prod) and greater dev-prod parity. This PR completely removes all use of Webpack in this repository.

`client/web` is the last build target that still uses Webpack; all others have been recently migrated to esbuild. Most devs here have been using esbuild for local dev of `client/web` for the last 6-12 months anyway. The change here is that now our production builds will be built by esbuild.

All sg commands, integration/e2e tests, etc., continue to work as-is. The bundlesize report will take a while to stabilize because the new build products use different filenames.

## Benchmarks

Running `pnpm run generate && time pnpm -C client/web run task:gulp webBuild` and taking the `time` output from the last command:

- Webpack: 62.5s
- esbuild: 6.7s

Note: This understates esbuild's victory for 2 reasons: (1) because esbuild is building both the main and embed entrypoints, whereas Webpack only builds the main entrypoint in this benchmark) and (2) because a lot of it is in the fixed startup time of `gulp`; esbuild incremental rebuilds during local dev only take ~1s.

## Notes

We no longer use Babel to produce web builds (we use esbuild), so we don't need any Babel plugins that optimize the output or improve browser compatibility. Right now, Babel is only used by Jest (for tests) and by Bazel as an intermediate step.
2023-10-23 10:59:06 -07:00
..
assets/img web: update branding colors and Sourcegraph logo images (#23751) 2021-08-13 18:58:09 +08:00
src remove storybook addon-docs (#57497) 2023-10-09 13:24:32 -10:00
.eslintignore web: moved Storybook config into a new package (#19569) 2021-04-08 17:16:26 +08:00
.eslintrc.js web: moved Storybook config into a new package (#19569) 2021-04-08 17:16:26 +08:00
BUILD.bazel chromatic: Fixup project detection and emit TurboSnap metadata with vite (#57494) 2023-10-09 22:56:52 +02:00
globals.d.ts Rely on MonacoWebpackPlugin for worker config (#25886) 2021-10-12 14:01:36 +02:00
jest.config.js web: moved Storybook config into a new package (#19569) 2021-04-08 17:16:26 +08:00
package.json use vite instead of webpack for storybooks (#57438) 2023-10-07 14:04:10 -10:00
README.md use vite instead of webpack for storybooks (#57438) 2023-10-07 14:04:10 -10:00
tsconfig.json Revert "revert "bazel: improve ESLint rule" (#52853)" (#52878) 2023-06-04 19:06:39 -07:00

Storybook configuration

Check out the Storybook section in the Developing the Sourcegraph web app docs.

Usage

Storybook configuration is set up as a pnpm workspace symlink.

Important commands are exposed via root package.json:

pnpm storybook
pnpm storybook:build

Environment variables

# Load only a subset of stories to boost build performance.
STORIES_GLOB='client/web/src/**/*.story.tsx' pnpm start