Skip to content

Commit

Permalink
[7.x] Turn off progress plugin in storybook (#98253) (#99067)
Browse files Browse the repository at this point in the history
* Turn off progress plugin in storybook (#98253)

Before:

```
info => Loading static files from /Users/smith/Code/kibana/node_modules/@kbn/ui-shared-deps/target and serving at /.
info => Loading presets
info => Loading presets
info => Loading 8 other files in "x-pack/plugins/apm/.storybook"
info => Adding stories defined in "x-pack/plugins/apm/.storybook/main.js"
info => Using default Webpack setup
... like 300MB of output ...
webpack built 0f7b67ae2a8a0401f5af in 105247ms
```

After:

```
info => Loading static files from /Users/smith/Code/kibana/node_modules/@kbn/ui-shared-deps/target and serving at /.
info => Loading presets
info => Loading presets
info => Loading 8 other files in "x-pack/plugins/apm/.storybook"
info => Adding stories defined in "x-pack/plugins/apm/.storybook/main.js"
info => Using default Webpack setup
... yeah it just sits there for a bit, but were you reading this and did you believe the percentages you were being told? ...
webpack built 0f7b67ae2a8a0401f5af in 105247ms
```

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	packages/kbn-storybook/webpack.config.ts

* Add back comment
  • Loading branch information
smith committed May 3, 2021
1 parent e28e63c commit 435f7fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/kbn-storybook/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Side Public License, v 1.
*/

import { resolve } from 'path';
import { externals } from '@kbn/ui-shared-deps';
import { stringifyRequest } from 'loader-utils';
import { resolve } from 'path';
import { Configuration, Stats } from 'webpack';
import webpackMerge from 'webpack-merge';
import { externals } from '@kbn/ui-shared-deps';
import { REPO_ROOT } from './lib/constants';

const stats = {
Expand Down Expand Up @@ -80,6 +80,12 @@ export default function ({ config: storybookConfig }: { config: Configuration })
stats,
};

// Disable the progress plugin
const progressPlugin: any = (storybookConfig.plugins || []).find((plugin: any) => {
return 'handler' in plugin && plugin.showActiveModules && plugin.showModules;
});
progressPlugin.handler = () => {};

// This is the hacky part. We find something that looks like the
// HtmlWebpackPlugin and mutate its `options.template` to point at our
// revised template.
Expand Down

0 comments on commit 435f7fd

Please sign in to comment.