mirror of
https://github.com/apache/superset.git
synced 2024-09-19 20:19:37 -04:00
build: optimize storybook config (#600)
- Output minimal webpack stats only when in development mode - Separate type checking and build, so failed typing does not block `yarn sb` watch rebuild - Rearrange addon loading order so knobs can appear as the first tab
This commit is contained in:
parent
84672b99b4
commit
e5feefe035
@ -1,4 +1,5 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||||
const { lstatSync, readdirSync } = require('fs');
|
const { lstatSync, readdirSync } = require('fs');
|
||||||
|
|
||||||
// find @superset-ui packages
|
// find @superset-ui packages
|
||||||
@ -15,16 +16,13 @@ const PLUGIN_PACKAGES_PATH_REGEXP = new RegExp(
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
addons: [
|
addons: [
|
||||||
'@storybook/preset-typescript',
|
'@storybook/preset-typescript',
|
||||||
'@storybook/addon-actions/register',
|
|
||||||
'@storybook/addon-knobs/register',
|
'@storybook/addon-knobs/register',
|
||||||
'storybook-addon-jsx/register',
|
'storybook-addon-jsx/register',
|
||||||
|
'@storybook/addon-actions/register',
|
||||||
'@storybook/addon-links/register',
|
'@storybook/addon-links/register',
|
||||||
],
|
],
|
||||||
stories: [
|
stories: ['../storybook/stories/**/*Stories.[tj]sx'],
|
||||||
'../storybook/stories/**/*Stories.[tj]sx',
|
|
||||||
],
|
|
||||||
webpackFinal: config => {
|
webpackFinal: config => {
|
||||||
|
|
||||||
// Make sure babel is applied to the package src
|
// Make sure babel is applied to the package src
|
||||||
// These are excluded by the default rule
|
// These are excluded by the default rule
|
||||||
// because they reside in node_modules
|
// because they reside in node_modules
|
||||||
@ -40,10 +38,15 @@ module.exports = {
|
|||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: require.resolve('ts-loader'),
|
loader: require.resolve('ts-loader'),
|
||||||
|
options: {
|
||||||
|
transpileOnly: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
config.plugins.unshift(new ForkTsCheckerWebpackPlugin());
|
||||||
|
|
||||||
config.resolve.extensions.push('.ts', '.tsx');
|
config.resolve.extensions.push('.ts', '.tsx');
|
||||||
|
|
||||||
// Let webpack know where to find the source code
|
// Let webpack know where to find the source code
|
||||||
@ -57,7 +60,11 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
config.stats = 'errors-warnings';
|
config.devtool = 'eval-cheap-module-source-map';
|
||||||
|
config.devServer = {
|
||||||
|
...config.devServer,
|
||||||
|
stats: 'minimal',
|
||||||
|
};
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user