Skip to content

Commit 43fb470

Browse files
authored
fix: storybook build times (#667)
1 parent 8cadd32 commit 43fb470

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.storybook/webpack.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ module.exports = ({ config }) => {
1313
config.plugins.push(
1414
new MomentLocalesPlugin({ localesToKeep: ['de', 'es', 'fr', 'zh-cn'] })
1515
);
16+
17+
if (process.env.NODE_ENV === 'production') {
18+
// remove progress plugin
19+
// progress plugin outputs a lot of console logs, which makes
20+
// netlify build realllllllllllllllly slow.
21+
config.plugins = config.plugins.filter(
22+
plugin => plugin.constructor.name !== 'ProgressPlugin'
23+
);
24+
config.devtool = 'none'; // TODO: should we use something differen?
25+
} else {
26+
config.devtool = 'cheap-module-source-map'; // TODO: should we use something differen?
27+
}
28+
1629
config.devtool = 'cheap-module-source-map'; // TODO: should we use something differen?
1730
config.module.rules = [
1831
// Disable require.ensure as it's not a standard language feature.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"design-tokens:build:watch": "nodemon -e yaml --quiet --watch materials/internals --exec 'yarn design-tokens:build'",
4040
"prebuild": "node ./scripts/generate-icon-exports.js && yarn design-tokens:build",
4141
"prestorybook:start": "node ./scripts/generate-icon-exports.js && yarn design-tokens:build",
42-
"storybook:build": "build-storybook -o .public -s docs/assets",
42+
"storybook:build": "NODE_ENV=production build-storybook -o .public -s docs/assets",
4343
"build": "rimraf dist && cross-env NODE_ENV=production rollup --config",
4444
"build:watch": "rimraf dist && cross-env NODE_ENV=production rollup --config --watch",
4545
"start": "yarn storybook:start",

0 commit comments

Comments
 (0)