Skip to content

Commit

Permalink
chore: 🤖 enable hot reload for typescript in storybook (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw authored and zhaoyongjie committed Nov 25, 2021
1 parent e58ce6e commit 950ad46
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ module.exports = (storybookBaseConfig, configType, defaultConfig) => {
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.

/* eslint-disable-next-line */
defaultConfig.resolve = defaultConfig.resolve || {};
/* eslint-disable-next-line */
defaultConfig.resolve.extensions = ['.ts', '.tsx', '.js', '.jsx'];

defaultConfig.plugins.push(new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
}));
defaultConfig.plugins.push(
new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
}),
);

defaultConfig.module.rules[0].use[0].options.plugins.push('@babel/plugin-syntax-dynamic-import');

Expand All @@ -31,7 +35,7 @@ module.exports = (storybookBaseConfig, configType, defaultConfig) => {
{
loader: 'thread-loader',
options: {
// there should be 1 cpu for the fork-ts-checker-webpack-plugin
// there should be 1 cpu for the fork-ts-checker-webpack-plugin
workers: os.cpus().length - 1,
},
},
Expand All @@ -48,4 +52,4 @@ module.exports = (storybookBaseConfig, configType, defaultConfig) => {

// Return the altered config
return defaultConfig;
};
};

0 comments on commit 950ad46

Please sign in to comment.